If, based on your additional question details, what you actually need is to extract all glyph outlines, then you're far better off using TTX
to extract the glyf
table as an XML file, and then simply read that in using PHP. Much easier to code, and seriously far less work.
However, and this is the biggie: having the glyph outlines is not the same as now being able to style text. Words like "difference" are not "d" + "i" + "f" + ...etc, because fonts also come with repositioning information to make sure certain letter combinations look better than if you just "drop letters one after another", and letters can get replaced with completely different outlines for even better looks (many good fonts will have a dedicated glyph for the "ff" ligature, for instance, which is completely different from just two "f" glyphs next to each other, both in terms of outline points and metrics).
But it seems like you're asking an XY Problem question, so it might be worth asking youself "why" five times.
- You want to parse a font in PHP. Why?
- Because you want all the glyphs in the font. Okay: why?
- Because... what are you going to use those for, and why?
- presumably you want to draw text. Where?
- On images? Your question is actually "How do I draw text on images in PHP?" (answer: imagemagick + im extension). On a page? Your question is actually "how do I get text with a specific font on a webpage" (answer: CSS
@font-face
rule), etc.
Stackoverflow can best help you when you don't ask about how to achieve what you've already imagined as solution to your problem, but when you state what you need to achieve, and then explain what you've already thought of, or tried.