6 ms·
How does a system know wether a font is sans-serif or not?
by dot 11y ago
How does a system know wether a font is sans-serif or not?
- rogeryu 11y agoThat's a setting in the browser, not the system.
- lottin 11y agoThe '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.
- drivers99 11y agoIt'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.
- TimJYoung 11y agoOn 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/dd162620(v=vs.85).aspx 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/dd145037(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/dd1... and the lfPitchAndFamily member will tell you what type of font it is.
- wmil 11y agoTTF / 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.