问题
What is the best way to deal with fonts in a multi-platform distributed system? If I want to use a common font across all systems to show to the user, what's the best way to do this. From the little I've been reading each platform looks to have fonts that are of the same family (ie serif, sans-serif) but with different names. CSS looks to have the functionality baked in where it will make the best selection it can of font on the users machine. Is there similar functionality either in system libraries or external libraries for Windows & Linux. I'm using C++ mainly?
Can someone point me in the right direction for documentation as well?
Thanks
回答1:
fontconfig is a cross-platform library for finding fonts by either direct name (Times Roman) or common aliases like serif - it's what most modern Linux software, like the GNOME & KDE desktops, use to find fonts, and is used in conjunction with libraries like Pango for text layout and FreeType for font rasterizing.
回答2:
I'd try Pango. AFAIK it is used by GTK+, Mozilla and Google Chrome (not sure about the latter).
来源:https://stackoverflow.com/questions/2678998/fonts-in-a-multi-platform-environment