last day (15 days later) » 

1:32 PM
-2
Q: Is there an algorithm to classify a TTF font into a generic font-family programmatically?

MariusI've been trying to develop a font maintenance application for our environment, and one of the aspects I need to group our fonts into is the generic font family (as per CSS). Thus: monospace, serif, sans-serif, fantasy, and cursive. I've been parsing the TTF fonts and have concluded the best plac...

 
I might be wrong here, but doesn’t the browser go the other way, with preset fonts for each CSS generic family? (Well, sets of fonts, for families and languages and platforms.) Not sure it ever ends up classifying arbitrary fonts into those generic families.
 
That was just an example, but they had made that choice in some way, perhaps programmatically, or perhaps visually. That is also unknown to me. I, however, as per my question, need an algorithmic way to get the same result programmatically.
I've done my research, I've read through: w3.org/Fonts/Panose/pan2.html And the entire TTF font spec. I also know most of the PDF spec. None of these actually give definitive answers on fantasy (or display font typeface) generic families.
 
Pretty sure they made it visually. So the problem as it pertains to CSS doesn’t really make sense.
 
I've removed that sentence as it was detracting from my question.
 
You still have “as per CSS” and that doesn’t make sense because you don’t actually have to pick a font matching the qualities of the generic family to represent that generic family.
So… it sounds like font classification should be done by someone entering the font into your system. Unless you want to do some kind of funky AI that’ll predict how people feel about whether a given font fits into a given CSS generic family.
 
1:36 PM
I do have a legitimate reason to ask it that way, but if a reason will help, it is because we design layout in a web control, I parse the HTML and translate it to low-level PDF all in a SAP ABAP backend (not in Windows/Mac/Linux alas. So I have to write all the TTF, PDF and HTML parsing code from scratch.) I've done all this and it works wonderfully.
Also, yeah, in hindsight letting the user choose may have been better. Although a lot of font hosting sites seem to be able to determine that information programmatically. And all that information is ostensibly available, and my algorithm seems to work very well to match fonts to the visual characteristics.
PS: The PANOSE classification is precisely that. A visual classification of the font typeface...
 
Pretty sure font hosting sites have users choose as well.
And sure, okay. But you found out it doesn’t map exactly and there’s still someone setting that field…
Anyway. fantasy specifically. If there’s not a field in the TTF format that means “fantasy”, it’s just something you have to ask…
 
Correct. An override would be good. But my question is still legitimate. How to map the panose to css generic families. Is there, or isn't there an algorithm? For my case, I will assume there isn't, until someone can answer the question and point me to one. In that case I'll HAVE to let the user override...
fantasy means decorative.
there are fields that specify that.
 
I know
 
kinda.
 
but it’s kinda not good enough apparently?
 
1:43 PM
Different resources I've read interpret it diferently...
A good discussion over here:
Which failed to go anywhere useful for me sadly...
 

last day (15 days later) »