freetype
[Top][All Lists]
Advanced

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

[ft] Generating text metrics on Linux and Windows.


From: Tony Smith
Subject: [ft] Generating text metrics on Linux and Windows.
Date: Mon, 17 Sep 2007 14:46:04 +0100

Hopefully this isn't too vague a question for this mailing list.
Does anyone know if you should get consistent results for generating text metrics on Windows and Linux using freetype2?

I don't seem to be able to generate consistent results.
In my tests I'm using version 2.3.5.
For example I tried some of the standard Windows true type fonts which are supplied with XP.
One example which generated different results was using Times New Roman, times.ttf, at (approximately) 8pt and 600 dpi.

Thanks for your time, Tony Smith


p.s. Here is some "code" to explain how I'm currently using freetype


FT_Library  library;
FT_Error error;

error = FT_Init_FreeType( &library );

const char * fontFile="times.ttf";
FT_Face      face;
error = FT_New_Face( library, fontFile, 0, &face );

double ptSize=7.992, dpi=600.0;
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
error = FT_Set_Char_Size( face, 0, (FT_F26Dot6)(pointSize*(CR_DOUBLE)64.0), dpi, dpi );

int charMetrics[256];
for( CR_INT32 ch=0; ch<256; ch++ )
{
  int glyph_index = FT_Get_Char_Index( face, (const CR_CHAR)ch );
  int load_flags=FT_LOAD_DEFAULT;
  load_flags += FT_LOAD_FORCE_AUTOHINT;
  error = FT_Load_Glyph( face, glyph_index, load_flags );
  charMetrics[ch] = face->glyph->advance.x;
}


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

reply via email to

[Prev in Thread] Current Thread [Next in Thread]