Re: Custom font for application
- From: Richard Shann <richard shann virgin net>
- To: gtk-app-devel-list gnome org
- Subject: Re: Custom font for application
- Date: Mon, 25 Jul 2011 15:42:10 +0100
On Mon, 2011-07-25 at 12:00 +0000, gtk-app-devel-list-request gnome org
wrote:
Does anyone here know how I can create and load a custom font for my
application from the source code? What method or methods do I need to
invoke to load the font that I can render? What rendering methods do I
need to override so that my custom fonts are the ones rendered? Are
there any examples of source code on how to achieve this?
The GNU/Denemo music typesetter uses a custom font, called denemo.ttf
You can look at its Makefiles for installation hints and src/utils.c for
setting font load paths. It invokes this font by using gtk's markup
language thus:
/* markup the passed string to be in the denemo music font
* caller must free the returned string
*/
gchar * music_font(gchar *str) {
return g_strdup_printf("<span font_desc=\"Denemo 12\">%s</span>",
str);
}
Where Denemo 12 is asking for denemo.ttf in 12pt.
I have all this at my fingertips because I want to change it so that I
don't have to switch fonts using markup, but instead use just one font
for both regular text and music symbols.
So I too need to know, how do you tell a gtk application to use a
specific font for all the widget labels and other text which it would
normally render in some default or use preferred font?
Richard Shann
http://www.denemo.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]