News for hackers. Stuff that matters.
Re:System shock: A story of a 25-year-old font coming back w... by jorams on Friday October 23, 2015 @05:49AM (#10437658)
I'm a bit confused about the use of "just give me a system font", then several named fonts and then "sans-serif". Isn't that exactly what "sans-serif" does, giving you a sans-serif system font?
Re:System shock: A story of a 25-year-old font coming back w... by igravious on Friday October 23, 2015 @05:51AM (#10437665)
"sans-serif" gives you the _browser's_ default sans-serif font, not the system font (which is generally (always?) sans-serif).
Re:System shock: A story of a 25-year-old font coming back w... by dot on Friday October 23, 2015 @05:51AM (#10437663)
How does a system know wether a font is sans-serif or not?
Re:System shock: A story of a 25-year-old font coming back w... by drivers99 on Friday October 23, 2015 @06:17AM (#10437733)
It's a browser setting. For example, I'm using Firefox 41 on Windows 7 and in Options->Content->Fonts&Colors/Advanced... it has "Times New Roman", "Arial", and "Courier New" as the defaults for Serif, Sans-serif, and Monospace respectively.

In Chrome, it's under Settings->+Show advanced settings->Web content/Customize fonts... (Times New Roman, Arial, Consolas on mine.)

In IE 11 under Tools (gear icon)->General->Appearance/Fonts it has "Webpage font" and "Plain text font" (Times New Roman and Courier New on mine). It's weird that they don't let you pick the default sans-serif font.

Re:System shock: A story of a 25-year-old font coming back w... by lottin on Friday October 23, 2015 @06:12AM (#10437719)
The 'sans-serif' font is an alias for the default sans-serif font, which is simply a system setting just like the default browser or the default whatever. Therefore the system doesn't need to know which fonts are sans-serif and which aren't.
Re:System shock: A story of a 25-year-old font coming back w... by TimJYoung on Friday October 23, 2015 @12:48PM (#10439744)
On Windows you can query for information about any font using the Windows API. This call allows you to enumerate fonts based upon their name, etc:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...

and the callback function used with it will get you this structure:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...

and the lfPitchAndFamily member will tell you what type of font it is.

Re:System shock: A story of a 25-year-old font coming back w... by rogeryu on Friday October 23, 2015 @05:58AM (#10437683)
That's a setting in the browser, not the system.
Re:System shock: A story of a 25-year-old font coming back w... by wmil on Friday October 23, 2015 @04:05PM (#10440989)
TTF / OTF fonts have quite a bit of meta data in them. I don't know the details but there are some flags regarding font family.