#ifdef __APPLE__ #include #else #include #endif #include #include static const char *fontName = "Times-Roman"; static CGGlyph glyphs[100]; static int advances[100]; static CGSize sizeAdvances[100]; static int len; /** This treats each character in str as a glyph name. * It then looks up these glyph names in the given font, and stores * the glyph numbers, their advances in glyph space units, * and their CGSize advances in text space units. */ void getGlyphs(CGFontRef font, CGFloat size, CFStringRef str) { len = [str length]; for (int i=0; i