Re: Pango and font path

On 09/18/2009 07:29 AM, Marcin Krystian Krzywonos wrote:

I'm creating an application in GTK+ (It's GTK# actually but it doesn't
matter. I know both libraries.) and there I've made some font
selector. It gets font list from Pango. So, user selects a font and
now I have to use file (i.e. *.ttf) of the selected font. How can I
get font path?

The way to do this is a bit skewed currently. If using the fontconfig backend, you can do this:

  - Use pango_context_load_font() to get a PangoFont of the desired description.

  - Get the font pattern and the file path out of it:

  const FcPattern *pattern = NULL;
  g_object_get (fcfont, "pattern", &pattern, NULL);
  if (pattern) {
    FcPatternGetString (pattern, FC_FILE, &s);


Best regards,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]