[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: New gaf on Windows and one PCB question
On Mon, 2010-01-18 at 20:20 -0200, Cesar Strauss wrote:
> >> I have a sneaky suspicion that there is a bug parsing the font size when
> >> that font size includes a decimal separator.
> >
> > Anyone who was able to reproduce the font-size bug, please could you try
> > this replacement gschem.exe:
> >
> > http://www2.eng.cam.ac.uk/~pcjc2/gschem.exe
> >
>
> It works!
>
> Also, changing the decimal point to "." in Control Panel allows the old
> version to work.
>
> Cesar
Super!! So we have a diagnosis.
This could really have been hard, but the Pango developer Behdad
Estafobad got me thinking with this comment:
> > (gschem.exe:3036): Pango-WARNING **: couldn't load font "Arial 10 400000", falling back to "Sans 400000", expect ugly output.
>
> What's with the 400,000pt size?!
^^___ subconscious clue...
When I checked the pango code for that message, it is just printing the
font description string, which gschem asks for as:
font_string = g_strdup_printf ("%s %f\n", FONT_NAME, font_size_pt);
It then clicked to me, that we're not asking for a 400000 point font,
we're asking for a 10.400000 point font, and somewhere along the line -
the message is getting muddled due to locale issues.
Behdad's suggested fix was to use non string based API to request the
font family and size explictly, hence the attached patch.
Cesar, perhaps you want to pick this up in minipack for 1.6.0 (I'll see
about getting something sorted for 1.6.1).
Goodness knows why this never manifested on the Freetype backend under
linux. (Perhaps it did - only had different symptoms - if that chooses
the "10" part of "10.40000", the effect wouldn't be nearly so
noticeable.
Best wishes,
Peter C.
>
>
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
--- /home/pcjc2/gedasrc/git/gschem/src/o_text.c 2010-01-18 22:32:08.320739809 +0000
+++ o_text.c 2010-01-18 22:32:33.891683442 +0000
@@ -159,7 +159,6 @@
PangoAttrList *attrs;
cairo_font_options_t *options;
double font_size_pt;
- char *font_string;
char *unescaped;
context = pango_layout_get_context (layout);
@@ -174,9 +173,10 @@
pango_cairo_context_set_resolution (context, 1000. * scale_factor);
font_size_pt = o_text_get_font_size_in_points (w_current->toplevel,
o_current);
- font_string = g_strdup_printf ("%s %f\n", FONT_NAME, font_size_pt);
- desc = pango_font_description_from_string (font_string);
- g_free (font_string);
+
+ desc = pango_font_description_new ();
+ pango_font_description_set_family_static (desc, FONT_NAME);
+ pango_font_description_set_size (desc, (int)((double)PANGO_SCALE * font_size_pt));
pango_layout_set_font_description (layout, desc);
font_metrics = pango_context_get_metrics (context, desc, NULL);
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user