17
17
along with pdfTeX; if not, write to the Free Software
18
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
$Id: writefont.c,v 1.3 2005/12/27 19:04:42 hahe Exp $
20
$Id: writefont.c 1139 2008-04-09 14:44:20Z taco $
23
23
#include "ptexlib.h"
122
122
fd->font_dim[ITALIC_ANGLE_CODE].val =
123
123
divide_scaled(-atan(get_slant(f) / 65536.0) * (180 / M_PI),
124
pdf_font_size[f], 3);
124
pdf_font_size(f), 3);
125
125
fd->font_dim[ASCENT_CODE].val =
126
divide_scaled(char_height(f, 'h'), pdf_font_size[f], 3);
126
divide_scaled(char_height(f, 'h'), pdf_font_size(f), 3);
127
127
fd->font_dim[CAPHEIGHT_CODE].val =
128
divide_scaled(char_height(f, 'H'), pdf_font_size[f], 3);
129
i = -divide_scaled(char_depth(f, 'y'), pdf_font_size[f], 3);
128
divide_scaled(char_height(f, 'H'), pdf_font_size(f), 3);
129
i = -divide_scaled(char_depth(f, 'y'), pdf_font_size(f), 3);
130
130
fd->font_dim[DESCENT_CODE].val = i < 0 ? i : 0;
131
131
fd->font_dim[STEMV_CODE].val =
132
divide_scaled(char_width(f, '.') / 3, pdf_font_size[f], 3);
132
divide_scaled(char_width(f, '.') / 3, pdf_font_size(f), 3);
133
133
fd->font_dim[XHEIGHT_CODE].val =
134
divide_scaled(get_x_height(f), pdf_font_size[f], 3);
134
divide_scaled(get_x_height(f), pdf_font_size(f), 3);
135
135
fd->font_dim[FONTBBOX1_CODE].val = 0;
136
136
fd->font_dim[FONTBBOX2_CODE].val = fd->font_dim[DESCENT_CODE].val;
137
137
fd->font_dim[FONTBBOX3_CODE].val =
138
divide_scaled(get_quad(f), pdf_font_size[f], 3);
138
divide_scaled(get_quad(f), pdf_font_size(f), 3);
139
139
fd->font_dim[FONTBBOX4_CODE].val =
140
140
fd->font_dim[CAPHEIGHT_CODE].val > fd->font_dim[ASCENT_CODE].val ?
141
141
fd->font_dim[CAPHEIGHT_CODE].val : fd->font_dim[ASCENT_CODE].val;
338
width = divide_scaled(char_width(f, i), pdf_font_size[f], 4);
338
width = divide_scaled(char_width(f, i), pdf_font_size(f), 4);
339
339
pdf_printf("%i", (int) width / 10); /* see adv_char_width() in pdftex.web */
340
340
if ((width = width % 10) != 0)
341
341
pdf_printf(".%i", width);
557
557
pdf_printf("/Encoding %i 0 R\n", (int) fo->fe->fe_objnum);
558
558
if (fo->tounicode_objnum != 0)
559
559
pdf_printf("/ToUnicode %i 0 R\n", (int) fo->tounicode_objnum);
560
if (pdf_font_attr[fo->tex_font] != get_nullstr()) {
561
pdf_print(pdf_font_attr[fo->tex_font]);
560
if (pdf_font_attr(fo->tex_font) != get_nullstr()) {
561
pdf_print(pdf_font_attr(fo->tex_font));
597
597
fo_entry *fo = new_fo_entry();
598
598
get_char_range(fo, f); /* set fo->first_char and fo->last_char from f */
599
if (fo->last_char>255) fo->last_char=255; /* added 9-4-2008, mantis #25 */
599
600
assert(fo->last_char >= fo->first_char);
601
602
fo->fo_objnum = font_objnum;
664
665
/* Create a virtual font map entry, as this is needed by the
665
666
* rest of the font inclusion mechanism.
667
/* TODO: take slant and extend from the texfont struct */
668
668
fm = new_fm_entry();
669
669
fm->tfm_name = font_name(f); /* or whatever, not a real tfm */
670
670
fm->ff_name = font_filename(f); /* the actual file */
671
671
fm->encname = font_encodingname(f); /* for the CIDSystemInfo */
672
672
fm->ps_name = font_fullname(f); /* the true name */
673
fm->slant = font_slant(f); /* slant factor */
674
fm->extend = font_extend(f); /* extension factor */
673
675
fm->fd_flags = 4; /* can perhaps be done better */
674
676
fm->in_use = true;
750
752
for (k = 1; k <= max_font_id(); k++) {
751
if ( k == f || -f == pdf_font_num[k]) {
753
if ( k == f || -f == pdf_font_num(k)) {
752
754
for (i = font_bc(k); i <= font_ec(k); i++) {
753
755
if (char_exists(k,i) && char_used(k,i)) {
754
756
j = xtalloc(1,glw_entry);
755
757
j->id = char_index(k,i);
756
j->wd = divide_scaled_n(char_width(k, i), pdf_font_size[k], 10000.0);
758
j->wd = divide_scaled_n(char_width(k, i), pdf_font_size(k), 10000.0);
757
759
if ((glw_entry *)avl_find(fo->fd->gl_tree,j) == NULL) {
758
760
aa = avl_probe(fo->fd->gl_tree, j);
759
761
assert(aa != NULL);
874
876
/* I doubt there is anything useful that could be written here */
876
if (pdf_font_attr[fo->tex_font] != get_nullstr()) {
877
pdf_print(pdf_font_attr[fo->tex_font]);
878
if (pdf_font_attr(fo->tex_font) != get_nullstr()) {
879
pdf_print(pdf_font_attr(fo->tex_font));