ttf->glyphs = rfx_calloc(num_glyphs*sizeof(ttfglyph_t));
double scale = 1.0;
int max_unicode = font->max_unicode;
+ int remap_pos=0;
for(t=0;t<font->num_glyphs;t++) {
gfxglyph_t*src = &font->glyphs[t];
ttfglyph_t*dest = &ttf->glyphs[t+offset];
}
dest->advance = src->advance*scale;
- if(src->unicode > max_unicode)
- max_unicode = src->unicode;
+
+ int u = font->glyphs[t].unicode;
+ if(u<32 || (u>=0xe000 && u<0xf900)) {
+ u = 0xe000 + remap_pos++;
+ }
+ if(u > max_unicode)
+ max_unicode = u;
}
ttf->unicode_size = max_unicode+1;
ttf->unicode = rfx_calloc(sizeof(unicode_t)*ttf->unicode_size);
+ remap_pos=0;
for(t=0;t<font->num_glyphs;t++) {
gfxglyph_t*src = &font->glyphs[t];
int u = font->glyphs[t].unicode;
- if(u>=0)
+ if(u<32 || (u>=0xe000 && u<0xf900)) {
+ u = 0xe000 + remap_pos++;
+ }
+ if(u>=0 && u<ttf->unicode_size)
ttf->unicode[u] = t+offset;
}
int u;
for(u=0;u<font->max_unicode;u++) {
int g = font->unicode2glyph[u];
- if(g>=0) {
+ if(u<32 || (u>=0xe000 && u<0xf900))
+ continue;
+ if(g>=0 && !ttf->unicode[u]) {
ttf->unicode[u] = g+offset;
}
}
ttf->descent = font->descent;
ttf->lineGap = font->ascent + font->descent;
+ ttf->name = strdup(font->id);
+
ttf_create_truetype_tables(ttf);
return ttf;
}