[squeak-dev] Pango fonts and font names query

David T. Lewis lewis at mail.msen.com
Thu Jul 31 00:44:32 UTC 2014


On Wed, Jul 30, 2014 at 05:06:23PM -0700, tim Rowledge wrote:
> A probably simple and not terribly important question for anyone familiar with how Pango/Cairo works wrt font names etc. but I?m curious.
> 
> Scratch does some font rendering with Pango, depending upon circumstances. The exact definition of those circumstances is, to say the least, a bit confusing, but never mind. What is puzzling me right now is that with one of asian languages selected (apologies to speakers but I?m not familiar enough with any of them to spot which is which on sight) the StringMorph in use has a StrikeFont (Scratch does some *interesting* things to handle OS font naming) called VerdanaBold installed.
> 
> When tracing through to see what happens with it in order to get the proper glyphs on screen we see some name manipulation to go from ?VerdanaBold' to ?Verdana' + bold:= true and then the UnicodePlugin interface to Pango is passed 
> 
> 	RenderPlugin
> 		primSetFont: fontName
> 		size: fontSize
> 		bold: isBold
> 		italic: false
> 		antialias: antialiasFlag.
> ? so we are passing ?Verdana? as the font name. Which would be fine - and produces appropriate glyphs - except that when listing all the fonts available from Pango, Verdana isn?t in the list. I?m wondering what happens inside all that plugin/library code. Is there a name conversion dictionary in use, some deeply buried config file??
> 

I know little about this topic, but I do recall that in X11, and probably
other similar systems, there is a font naming convention that is used
for looking up fonts. See http://www.x.org/docs/XLFD/xlfd.pdf for an overview,
and try "xlsfonts -l" on your linux box to get a feel for it.

I suspect that Pango works in a similar manner, such that a plugin would
identify a desired font by a font name, size, boldness, etc.

So it would make sense that something in the image that wants to ask
a plugin to find a 'VerdanaBold' font would contrive some way to turn
this into a request to the plugin for 'Verdana' where the bold attribute
is true. No doubt this is some sort of expedient hack, but it does seem
to make sense.

I have no idea how this might translate into non-European languages.

Dave



More information about the Squeak-dev mailing list