Hi to all. I think that if I do a fullembed of a font, it is not correct to include the only charwidth used in the pdf. Think about a font used in a /Form.
I tested the attached patch and it seems ok in my case, but I'm not sure it is fully OK. Thanks, Luca
diff --git a/texk/web2c/luatexdir/font/writefont.c b/texk/web2c/luatexdir/font/writefont.c index 73500d3a..2dec17be 100644 --- a/texk/web2c/luatexdir/font/writefont.c +++ b/texk/web2c/luatexdir/font/writefont.c @@ -956,29 +956,58 @@ static void mark_cid_subset_glyphs(fo_entry * fo, internal_font_number f) static void write_cid_charwidth_array(PDF pdf, fo_entry * fo) { - int i, j; - glw_entry *glyph; - struct avl_traverser t; - fo->cw_objnum = pdf_create_obj(pdf, obj_type_others, 0); - pdf_begin_obj(pdf, fo->cw_objnum, OBJSTM_ALWAYS); - avl_t_init(&t, fo->fd->gl_tree); - glyph = (glw_entry *) avl_t_first(&t, fo->fd->gl_tree); - i = (int) glyph->id; - pdf_begin_array(pdf); - pdf_add_int(pdf, i); - pdf_begin_array(pdf); - for (; glyph != NULL; glyph = (glw_entry *) avl_t_next(&t)) { - j = glyph->wd; - if (glyph->id > (unsigned) (i + 1)) { - pdf_end_array(pdf); - pdf_add_int(pdf, glyph->id); - pdf_begin_array(pdf); - } - pdf_check_space(pdf); - pdf_print_cid_charwidth(pdf, fo->tex_font, j); - i = (int) glyph->id; - pdf_set_space(pdf); - } + if(is_subsetted(fo->fm)) { + int i, j; + glw_entry *glyph; + struct avl_traverser t; + fo->cw_objnum = pdf_create_obj(pdf, obj_type_others, 0); + pdf_begin_obj(pdf, fo->cw_objnum, OBJSTM_ALWAYS); + avl_t_init(&t, fo->fd->gl_tree); + glyph = (glw_entry *) avl_t_first(&t, fo->fd->gl_tree); + i = (int) glyph->id; + pdf_begin_array(pdf); + pdf_add_int(pdf, i); + pdf_begin_array(pdf); + for (; glyph != NULL; glyph = (glw_entry *) avl_t_next(&t)) { j = glyph->wd; + if (glyph->id > (unsigned) (i + 1)) { + pdf_end_array(pdf); + pdf_add_int(pdf, glyph->id); + pdf_begin_array(pdf); + j = glyph->wd; + } + pdf_check_space(pdf); + pdf_print_cid_charwidth(pdf, fo->tex_font, j); + i = (int) glyph->id; + pdf_set_space(pdf); + } + } else { + internal_font_number f = fo->tex_font; + int l = font_size(f); + int i, j; + fo->cw_objnum = pdf_create_obj(pdf, obj_type_others, 0); + pdf_begin_obj(pdf, fo->cw_objnum, OBJSTM_ALWAYS); + pdf_begin_array(pdf); + int jj = 0; + + unsigned id; + for (i = font_bc(f); i <= font_ec(f); i++) { + if ( quick_char_exists(f, i)) { + id = (unsigned) char_index(f, i); + j = divide_scaled_n(char_width(f, i), l, 10000.0); + if(jj == 0 ) { + pdf_add_int(pdf, i); + pdf_begin_array(pdf); + } + jj++; + pdf_end_array(pdf); + pdf_add_int(pdf, id); + pdf_begin_array(pdf); + pdf_check_space(pdf); + pdf_print_cid_charwidth(pdf, fo->tex_font, j); + pdf_set_space(pdf); + } + } + } pdf_end_array(pdf); pdf_end_array(pdf);
_______________________________________________ dev-luatex mailing list -- dev-luatex@ntg.nl To unsubscribe send an email to dev-luatex-le...@ntg.nl