Re: GTK+3 fonts
On Sun, 2012-10-21 at 15:42 -1000, Roger Davis wrote: > I'm thinking that my better strategy at > this point is to just #ifdef my app code to specifically request DejaVu > Sans on the Mac, rather than having to tweak these fontconfig files on > each Mac in addition to hand-installing DejaVu. Or request it everywhere. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
Thanks for all the followup, Liam & Michael! By default I believe the mac changes antialiasing and hinting strategies (is this 16pt or 16px?) I'm using the simple Cairo text drawing functions here. Size is being set as Cairo user space units, which should be just pixels as I'm using the unmodified coordinate space. Thanks to both of you for pointing out all of the config stuff in /etc/fonts (/opt/local/etc/fonts on MacOS with MacPorts). I believe I have found the config file there which is aliasing Sans to the Vera font. In 60-latin.conf: ... sans-serif Bitstream Vera Sans DejaVu Sans Looks like a list of fonts that are aliased as substitutes for sans-serif, with Vera at the top of the list. I suspect if I re-ordered the list I could get things the way I wanted. I'm thinking that my better strategy at this point is to just #ifdef my app code to specifically request DejaVu Sans on the Mac, rather than having to tweak these fontconfig files on each Mac in addition to hand-installing DejaVu. Anyway, you guys have given me plenty of things to look into, thanks very much! Roger ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
On Sun, 2012-10-21 at 09:58 -1000, Roger Davis wrote: > when I > downsize my font display to smaller sizes (anything 16 or below), the font > weight appears to make a dramatic shift from Book to ExtraLight. By default I believe the mac changes antialiasing and hinting strategies (is this 16pt or 16px?) > Second, at some point during my fiddling around this morning, the > following files magically appeared in /opt/X11/share/fonts/TTF: > > % ls -l fo* > 120 -rw-r--r-- 1 root wheel 57364 Oct 21 06:52 fonts.dir >8 -rw-r--r-- 1 root wheel 1962 Oct 21 06:51 fonts.list > 120 -rw-r--r-- 1 root wheel 57364 Oct 21 06:51 fonts.scale mkfontscale does this (and/or mkfontdir) The files are being ignored in practice by gtk. They are for legacy applications that still use X-native font machinery, and are read by the X server and by the X font server, if it's in use. It shouldn't be. > Finally, I did some experimenting with removing ttf files from > /opt/X11/share/fonts/TTF. I found that if I got rid of the Vera*ttf files, > then this happened: > % fc-match yuk-yuk > Vera.ttf: "Bitstream Vera Sans" "Roman" Yes, there's a fallback defined in one of he fonts.conf files. > I suppose what I would like to do on my Mac is have it use DejaVu Sans to > satisfy a Sans request (because DejaVu has the UTF-8 characters I need and > Vera does not) The pango renderer will try to substitute glyphs from other fonts as needed, so this shouldn't be a problem. It's possible that some other gtk+ back end doesn't do this. You can edit the fonts.conf files to change the default font. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
On 10/21/2012 01:58 PM, Roger Davis wrote: > % fc-match Sans > DejaVuSans.ttf: "DejaVu Sans" "Book" > > And if I put them back, things are restored as before: > > % fc-match Sans > Vera.ttf: "Bitstream Vera Sans" "Roman" > > Can anyone explain how this works? Is there some complicated font > parameter examination taking place here, or is it as simple, at least in > some cases, as a single defined fallback font for everything when a > specified font cannot be located? Curiously, this test returns the same > fallback font: > > % fc-match yuk-yuk > Vera.ttf: "Bitstream Vera Sans" "Roman" > > I suppose what I would like to do on my Mac is have it use DejaVu Sans to > satisfy a Sans request (because DejaVu has the UTF-8 characters I need and > Vera does not), but without having to delete the Vera fonts from my > system, which might break God-knows-what-all. Is there a way to do this? All of this is specified in the fontconfig configs. On linux, this is normally in /etc/fonts/conf*. I don't know where they are on macports, but probably in a similar path, maybe /opt/etc/fonts. These config files specify the logic fontconfig should use in searching for a font which is rendered via freetype. Substitutions and fallback fonts are all specified here. This way if someone just requests "sans" or "roman," they get a suitable font, if installed, or the fallback font. Also fontconfig specifies what to do at smaller font sizes, how to do hinting, etc. It's possible that the hinting is changing as the font get smaller. Maybe on macports they default to having more and more hinting at smaller sizes for legibility, whereas on CentOS they don't turn on as much hinting (I turn it off completely on my Fedora machines). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
Hi all, OK, I've made some progress based on everyone's suggestions, and focused my questions a bit more, I think. Copying the Deja*.ttf files into /opt/X11/share/fonts/TTF *did* make a difference, and they are now seen by my apps, but this fact was momentarily obscured by one of my remaining problems, namely that when I downsize my font display to smaller sizes (anything 16 or below), the font weight appears to make a dramatic shift from Book to ExtraLight. This happens on the Mac but not on CentOS. Anyone know why this is happening and if there is a way to prevent it? Second, at some point during my fiddling around this morning, the following files magically appeared in /opt/X11/share/fonts/TTF: % ls -l fo* 120 -rw-r--r-- 1 root wheel 57364 Oct 21 06:52 fonts.dir 8 -rw-r--r-- 1 root wheel 1962 Oct 21 06:51 fonts.list 120 -rw-r--r-- 1 root wheel 57364 Oct 21 06:51 fonts.scale I don't believe I did anything other than copy some ttf files into this directory and run fc-match and fc-list a few times. Does anyone know how these get created, and is their presence critical to anything, particularly any kind of font lookup procedure? It's quite possible that they were there before I started tweaking things, but their modification times have clearly been updated, and the fonts.list file now contains references to the new DejaVuSans fonts. Finally, I did some experimenting with removing ttf files from /opt/X11/share/fonts/TTF. I found that if I got rid of the Vera*ttf files, then this happened: % fc-match Sans DejaVuSans.ttf: "DejaVu Sans" "Book" And if I put them back, things are restored as before: % fc-match Sans Vera.ttf: "Bitstream Vera Sans" "Roman" Can anyone explain how this works? Is there some complicated font parameter examination taking place here, or is it as simple, at least in some cases, as a single defined fallback font for everything when a specified font cannot be located? Curiously, this test returns the same fallback font: % fc-match yuk-yuk Vera.ttf: "Bitstream Vera Sans" "Roman" I suppose what I would like to do on my Mac is have it use DejaVu Sans to satisfy a Sans request (because DejaVu has the UTF-8 characters I need and Vera does not), but without having to delete the Vera fonts from my system, which might break God-knows-what-all. Is there a way to do this? Thanks! Roger ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
How would I (re)configure freetype to recognize new .ttf files that I have manually copied into /opt/X11/share/fonts? Sorry, that should have been /opt/X11/share/fonts/TTF, where I stuck all the DejaVu*.ttf files copied from my CentOS machine. fc-list at least is able to find these now, but my own apps don't: % fc-list | grep Deja /usr/X11/lib/X11/fonts/TTF/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique /usr/X11/lib/X11/fonts/TTF/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique /usr/X11/lib/X11/fonts/TTF/DejaVuSans.ttf: DejaVu Sans:style=Book ... etc. /usr/X11/lib/X11/fonts is a symbolic link to /opt/X11/share/fonts. Thanks, Roger ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
Thanks, Michael. My MacOS GTK+3 install is using the X11 backend, or so I assume given that when my apps appear they have a small X icon embedded into each window titlebar. You said that in this case font usage is controlled by freetype. How would I (re)configure freetype to recognize new .ttf files that I have manually copied into /opt/X11/share/fonts? Thanks! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
$ fc-match Sans DejaVuSans.ttf: "DejaVu Sans" "Book" Aargh, I'm stupid, Liam! Somehow I managed to skip over the key piece of information you supplied in your brief response. Here's what I get on my Mac: % fc-match Sans Vera.ttf: "Bitstream Vera Sans" "Roman" Obviously this explains a lot. Looking around on the Mac I was able to 'find' these: % sudo find / -name '*Vera*' -print /opt/X11/share/fonts/TTF/Vera.ttf /opt/X11/share/fonts/TTF/VeraBd.ttf ... lots more Vera*.ttf files in /opt/X11/share/fonts/TTF ... ... but also a bunch of other stuff here: /System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/Resources/FontInfo/BitstreamVeraSans-Bold.fontinfo /System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/Resources/FontInfo/BitstreamVeraSans-BoldOblique.fontinfo ... I suspect, but can't be sure, that the latter files were part of the MacOS install. The ttf files in /opt/X11/share/fonts/TTF almost certainly came from either a MacPorts package install (which could have been either from the gtk3 package or any one of a number of X11-related packages) or from an XQuartz install (Mountain Lion no longer has integrated X11, you must install XQuartz separately), and I have no idea which. Anyway, I tar'd up all the DejaVu*ttf files from /usr/share/fonts on my CentOS 6 machine and dumped them into /opt/X11/share/fonts on the Mac, but my app does not seem able to find them there, and fc-match still says that Sans is aliased to the Bitstream Vera font. It would seem that there is still some other piece of font lookup information that is missing. Any idea on what that might be? Thanks! Roger ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
On 10/21/2012 04:16 AM, Roger Davis wrote: > Any explanation for these mysteries, or any pointers to some decent > documentation on Gnome 2/3 font configuration and installation? If you are using Gtk+3 with the native/quartz backend, then the fonts it uses are coming from the native OS X font system. If you are using the X11 backend, then the fonts come from where ever freetype is configured to pull them from, which on OS X could be somewhere in the macports install directory, and maybe from the OS X system font directory. Most fonts on OS X are *.otf, not *.ttf, which could be why you can't find them with a search. As for font rendering differences, if you are using the quartz backend, then it's likely that the font rendering is being done by OS X and quartz, not freetype. So any differences are a result of their algorithms (which do no font hinting whatsoever). ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK+3 fonts
Hi Liam, Thanks for explaining the Sans alias. I was wondering about that, as looking around on my CentOS 6 system I was able to find most of the Gnome fonts in /usr/share/fonts (including the DejaVu fonts), but was not able to find the Sans font anywhere. Playing around with the gnome-terminal profiles font selection dialog, it appears that Sans is an alias for DejaVu Sans Book. Digging a little deeper, I am noticing a number of bewildering differences between my CentOS 6 and Mac systems with regard to this font problem, however, and it's not at all clear why the differences exist, partly because (i) my CentOS system is basically a Gnome 2 environment to which I have added GTK+3 and related (i.e., up-to-date glib, cairo, etc.) libraries, and (ii) although I don't think that my Mac is similarly polluted with any Gnome 2 packages (as I only installed the MacPorts gtk3 atop the base MacOS), it probably does not have anywhere close to a full set of Gnome fonts of any vintage. I have a test drawing program (that calls the Cairo font selection and text drawing routines) which allows me to specify a font and fontsize and some arbitrary text. On CentOS, when I use DejaVu Sans and gradually decrement the size from about 24 down to 14, for instance, the rendered text all looks basically the same, just smaller as one would expect. Running the same test code on the Mac, however, when I move from 17 to 16 using DejaVu Sans, the text actually changes markedly in appearance to something that looks more like DejaVu Sans ExtraLight at the smaller size. Also, a certain UTF-8 character ("\342\206\220", a left arrow) that renders just fine on CentOS with DejaVu Sans does not render at all on Mac OS, even at the larger font sizes which look more similar to the CentOS DejaVu Sans. (This character instead renders as a small boxed rectangle around a blank space, which I interpret to mean that the font does not support that particular UTF-8 value.) Finally, I can't seem to locate the Gnome fonts anywhere on my Mac, although when I use my test program to draw with certain fonts (Courier 10 Pitch, Nimbus Mono L) cairo seems to find something reasonable. Under CentOS they are in /usr/share/fonts (although this is probably their Gnome 2 location, I have no idea where a full Gnome 3 installation would put them). On my Mac, however, I did a find (Unix shell command) search and the only DejaVu files I could locate were in /Applications/OpenOffice.org.app/Contents/basis-link/share/fonts/truetype/DejaVuSans.ttf which seem to be part of the OpenOffice package and not part of any installed Gnome fonts. Any explanation for these mysteries, or any pointers to some decent documentation on Gnome 2/3 font configuration and installation? Thanks! Roger On Sun, 21 Oct 2012, Liam R E Quin wrote: On Sat, 2012-10-20 at 20:23 -1000, Roger Davis wrote: Hi all, I [...] am partial to the Sans font for various reasons. On most linux systems this is actually an alias, not a font name. Here, it's DejaVu Sans Book: $ fc-match Sans DejaVuSans.ttf: "DejaVu Sans" "Book" $ so, add DejaVuSans.ttf to your Mac. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list