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

Re: Compiling the CVS Tree



At 04:57 29.12.02 -0600, Lars Clausen wrote:
>On Sat, 28 Dec 2002, Janne Heikkinen wrote:
>> [...]
>> Another problem I have with CVS version is that fonts are really huge,
>> with following change to lib/font.c I get normal sized fonts:
>> 
>> static real global_size_one = 1.0; /* 28.35; */
>
>This value is what converts between centimeters (used internally in Dia)
>and points:  72 pt/in / 2.54 cm/in = 28.35 pt/cm.  This might be the same
>error that Steffan ran into:  
>http://bugzilla.gnome.org/show_bug.cgi?id=99876
>
>Hans also mentioned having to have that as 1.0 or thereabouts.  How very
>confusing. 
>
Nope. The FREETYPE code is using this factor _twice_ which IMO is 
questionable. The one definition as constant like the comment says
is ok, but just using it a second time as in
lib/font.c:dia_font_build_layout 

#ifdef HAVE_FREETYPE
    height *= global_size_one;
#elif defined G_OS_WIN32
    height *= 0.7;
#endif

appears to be wrong. It would be nice to know if changing only
the second appearence to 1.0 would solve the 'huge fonts problem'.

My current - unverfied - interpretation is as follows:
- Pango is expecting its size in points, thus we need to translate
  from Dia's centimeter to point. See comment about global_size_one.
- Pango gives font sizes in pixels (drawn). This size is infuenced by
  the resolution of the monitor (or what X or GDI thinks it is).
  There is some code in pango/pango/pangowin32-fontmap.c which does
  exactly this :

  fontmap->resolution = PANGO_SCALE / GetDeviceCaps (pango_win32_hdc,
LOGPIXELSY) * 72.0;

  It maybe be possible to get on the correct factor with the attached
test program. Or after looking at it's output on my notebook maybe 
not :-(

D:\devel\my-gtk\simples>fontres
Screensize is 800x572 pixels  211x158 mm
Resolution 96x91 dpi
Pixels per cm : 37.9 x 36.2
Dia's magic font factor should be 0.527500(w) or 0.552448(h)

The best working factor for win32 is between 0.7 .. 0.71 which
could be :
	- 72 dpi / 96 dpi
	- 20 / 28.35
	- something completely different

As Lars says: 'How very confusing' :)

>> Correct fix is probably to edit some X or pango configuration file
>> but I don't know excatly what file I should edit.
>
>That differs from distribution to distribution.  Can't help you yet.
>
Another theory where this second factor comes from would be nice ...

	Hans
#include <gtk/gtk.h>

/*
 * Our font size is defined in cm, now we need points
 * A point is 1/72 inch.
 *
 * 20 pixels ^= 1 cm (convention)
 * 1 inch = 2.54 cm
 *
 * So point per cm is : 
 */
static float global_size_one = 72.0 / 2.54;

int main(int argc,char **argv)
{
  int w, h, wmm, hmm;
  float ppcm;

  gtk_init(&argc,&argv);

  w = gdk_screen_width();
  h = gdk_screen_height();
  wmm = gdk_screen_width_mm ();
  hmm = gdk_screen_height_mm ();

  g_print ("Screensize is %dx%d pixels  %dx%d mm\n", w, h, wmm, hmm);

  if (wmm > 0 && hmm > 0)
    g_print ("Resolution %dx%d dpi\n",
             (int)((w * 25.4) / wmm), (int)((h * 25.4) / hmm));
  else
    g_print ("Resolution info invalid\n");

  /* 20 pixels should be 1 cm */
  g_print ("Pixels per cm : %.1f x %.1f\n", w / (wmm / 10.0), h / (hmm / 10.0));
  ppcm = h / (hmm / 10.0);
  g_print ("Dia's magic font factor should be %f(w) or %f(h)\n", 
           wmm / (w / 2.0), hmm / (h / 2.0));

  return 0;
}
           

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK