I can do tell ya the story.
1. write a meta-data loader 2. write a glyph-index-table loader 3. write a glyph-shape & -points loader (from a choosen glyph) 4. ^- accurately here you can work with curve-tesselation (see example code) 5. you gain the siluette of many layers a glyph is havin (aside from the possibility of composed shapes) 6. Rebuild the shape with polygons 7. You do think "O" is a bordered shape? Wrong. Cut holes in glyphs with csg (construct solid geometry) in 2D. 8. Recreate normals and uv-coords and you able doing textured texts.
Alternatively you can do what i huv wrote already (see last post) and use free alternatives. So far i know blitzmax is havin a wrapper for opentype (exits as module from some one :-). you can modify it and create ya font-converter.
Here are some screenshots from my loader. Chinese is not supported. LTR is not supported. And many other things are not supported. You can gain me for a project. I do a importer for you (integrated in ya product!) for $1200 in a week. Is that ok!?
int tesselateCurve(textManager_fontEngineTTF_fontInfo_data* points, int* num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int nn) {
int tcr = 0
float mx=(x0+2.0*x1+x2)/4.0
float my=(y0+2.0*y1+y2)/4.0
float dx=(x0+x2)/2.0-mx
float dy=(y0+y2)/2.0-my
if ( nn > 16 ) {
tcr = 1
}
if ( tcr == 0 ) {
bool deciA = false
if ( dx*dx+dy*dy > objspace_flatness_squared ) {
tesselateCurve(points, num_points, x0, y0, (x0 + x1) / 2.0, (y0 + y1) / 2.0, mx, my, objspace_flatness_squared, nn + 1)
tesselateCurve(points, num_points, mx, my, (x1 + x2) / 2.0, (y1 + y2) / 2.0, x2, y2, objspace_flatness_squared, nn + 1)
deciA = true
}
if ( deciA == false ) {
addPoint(points, num_points:intValue, x2, y2)
num_points:intValue = num_points:intValue + 1
}
}
return(tcr)
}
|