Thanks for the help Werner. I've analysed the metrics generated by FreeType further with the simple code below. FreeType does generate consistent results between the two builds on Windows and Linux. The problem lies with my "production" code.
Sorry for the inconvenience, Tony Smith -----Original Message----- From: Werner LEMBERG [mailto:[EMAIL PROTECTED] Sent: 24 September 2007 21:41 To: [EMAIL PROTECTED] Subject: Re: [ft] Generating text metrics on Linux and Windows. [Please stay on the list so that other sees your comments too!] > When I said comparing text metrics on Linux and Windows I meant using > the same "FreeType" code. You say that you get different results for a TrueType font using the same FreeType code? Uh, oh, this must not happen, at least not with TrueType fonts. > The basis of the code was added to the bottom of my initial query. Please post the differing results. > Would it be more convenient if I had this code in a standard main > (C) function. I've adapted your code to be compilable with g++; see below, together with the result. I've used times.ttf version 3.00 and plain FreeType 2.3.5. > I did try some basic tests to compare metrics generated using the > Windows FONT technology with ones generated using FreeType. They did > seem to be different but I thought that this would just be too big an > ask to get the same values. They should be the same, provided you don't ask for ClearType rendering. Werner ====================================================================== #include <ft2build.h> #include FT_FREETYPE_H #include <stdio.h> int main() { 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; int dpi = 600; error = FT_Select_Charmap(face, FT_ENCODING_UNICODE); error = FT_Set_Char_Size(face, 0, (FT_F26Dot6)(ptSize * (double)64.0), dpi, dpi); int charMetrics[256]; for(int ch = 0; ch < 256; ch++) { int glyph_index = FT_Get_Char_Index(face, 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; printf("%d: %d\n", ch, charMetrics[ch]); } return 0; } ====================================================================== 0: 3328 1: 3328 2: 3328 3: 3328 4: 3328 5: 3328 6: 3328 7: 3328 8: 3328 9: 3328 10: 3328 11: 3328 12: 3328 13: 3328 14: 3328 15: 3328 16: 3328 17: 3328 18: 3328 19: 3328 20: 3328 21: 3328 22: 3328 23: 3328 24: 3328 25: 3328 26: 3328 27: 3328 28: 3328 29: 3328 30: 3328 31: 3328 32: 1088 33: 1344 34: 1664 35: 2112 36: 2112 37: 3520 38: 3264 39: 768 40: 1472 41: 1408 42: 2176 43: 2368 44: 1088 45: 1472 46: 1088 47: 1152 48: 2048 49: 2176 50: 2176 51: 2176 52: 2112 53: 2112 54: 2176 55: 2112 56: 2176 57: 2176 58: 1152 59: 1216 60: 2368 61: 2368 62: 2368 63: 1920 64: 3904 65: 3136 66: 2880 67: 2816 68: 3136 69: 2624 70: 2368 71: 3072 72: 3072 73: 1472 74: 1728 75: 3072 76: 2560 77: 3776 78: 3072 79: 3072 80: 2304 81: 3072 82: 2816 83: 2368 84: 2560 85: 3136 86: 3136 87: 4032 88: 3136 89: 3072 90: 2624 91: 1408 92: 1152 93: 1408 94: 1984 95: 2176 96: 1408 97: 1920 98: 2112 99: 1856 100: 2112 101: 1856 102: 1408 103: 2112 104: 2176 105: 1152 106: 1280 107: 2176 108: 1216 109: 3392 110: 2176 111: 2112 112: 2112 113: 2112 114: 1472 115: 1600 116: 1216 117: 2112 118: 2176 119: 3136 120: 2112 121: 2240 122: 1856 123: 2048 124: 832 125: 2112 126: 2304 127: 3328 128: 3328 129: 3328 130: 3328 131: 3328 132: 3328 133: 3328 134: 3328 135: 3328 136: 3328 137: 3328 138: 3328 139: 3328 140: 3328 141: 3328 142: 3328 143: 3328 144: 3328 145: 3328 146: 3328 147: 3328 148: 3328 149: 3328 150: 3328 151: 3328 152: 3328 153: 3328 154: 3328 155: 3328 156: 3328 157: 3328 158: 3328 159: 3328 160: 1088 161: 1408 162: 2112 163: 2112 164: 2112 165: 2240 166: 832 167: 2112 168: 1408 169: 3200 170: 1216 171: 2112 172: 2432 173: 1472 174: 3200 175: 2176 176: 1664 177: 2368 178: 1280 179: 1280 180: 1408 181: 2432 182: 1920 183: 1088 184: 1472 185: 1280 186: 1344 187: 2112 188: 3200 189: 3200 190: 3200 191: 1920 192: 3136 193: 3136 194: 3136 195: 3136 196: 3136 197: 3136 198: 3776 199: 2816 200: 2624 201: 2624 202: 2624 203: 2624 204: 1472 205: 1472 206: 1472 207: 1472 208: 3072 209: 3072 210: 3072 211: 3072 212: 3072 213: 3072 214: 3072 215: 2432 216: 3072 217: 3136 218: 3136 219: 3136 220: 3136 221: 3072 222: 2368 223: 2112 224: 1920 225: 1920 226: 1920 227: 1920 228: 1920 229: 1920 230: 2816 231: 1856 232: 1856 233: 1856 234: 1856 235: 1856 236: 1152 237: 1152 238: 1152 239: 1216 240: 2112 241: 2176 242: 2112 243: 2112 244: 2112 245: 2112 246: 2112 247: 2368 248: 2112 249: 2112 250: 2112 251: 2112 252: 2112 253: 2240 254: 2112 255: 2240 ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________ ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________ _______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype
