summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir/writettf.c
diff options
context:
space:
mode:
authorHan The Thanh <hanthethanh@gmail.com>2008-07-03 16:11:52 +0000
committerHan The Thanh <hanthethanh@gmail.com>2008-07-03 16:11:52 +0000
commitc2c5c262b00a301d7731c9422843454457fb4429 (patch)
treeb7718cf68b709954f17758871b7580fa07891ecb /Build/source/texk/web2c/pdftexdir/writettf.c
parentc51e576c58e88a1f340770fe162fb2c1ac98ff87 (diff)
some bugfixes for pdftex:
- a bugfix for TrueType font handling - a bugfix for pdf inclusion git-svn-id: svn://tug.org/texlive/trunk@9192 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir/writettf.c')
-rw-r--r--Build/source/texk/web2c/pdftexdir/writettf.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/writettf.c b/Build/source/texk/web2c/pdftexdir/writettf.c
index 9e3900c5de0..19c137bed48 100644
--- a/Build/source/texk/web2c/pdftexdir/writettf.c
+++ b/Build/source/texk/web2c/pdftexdir/writettf.c
@@ -53,7 +53,7 @@ typedef struct {
typedef struct {
char *name; /* name of glyph */
long code; /* charcode in case of subfonts */
- short newindex; /* new index of glyph in output file */
+ long newindex; /* new index of glyph in output file */
} ttfenc_entry;
@@ -72,7 +72,7 @@ typedef struct {
char *ttf_name;
TTF_USHORT pid;
TTF_USHORT eid;
- short *table;
+ long *table;
} ttf_cmap_entry;
static TTF_USHORT ntabs;
@@ -348,7 +348,7 @@ static void ttf_read_name(void)
{
int i, j;
dirtab_entry *tab = ttf_seek_tab("name", TTF_USHORT_SIZE);
- char *p;
+ char *p, buf[SMALL_BUF_SIZE];
name_record_num = get_ushort();
name_tab = xtalloc(name_record_num, name_record);
name_buf_size = tab->length -
@@ -380,12 +380,14 @@ static void ttf_read_name(void)
if (!fd_cur->font_dim[FONTNAME_CODE].set) {
for (i = 0; i < name_record_num; i++) {
if (name_tab[i].platform_id == 3 &&
- (name_tab[i].encoding_id == 0 ||
- name_tab[i].encoding_id == 1) && name_tab[i].name_id == 6) {
- for (j = 0, p = fd_cur->fontname; j < name_tab[i].length;
- j += 2)
+ (name_tab[i].encoding_id == 0 || name_tab[i].encoding_id == 1) &&
+ name_tab[i].name_id == 6) {
+ xfree(fd_cur->fontname);
+ assert(name_tab[i].length < sizeof(buf));
+ for (j = 0, p = buf; j < name_tab[i].length; j += 2)
*p++ = name_buf[name_tab[i].offset + j + 1];
*p = 0;
+ fd_cur->fontname = xstrdup(strip_spaces_and_delims(buf, strlen(buf)));
fd_cur->font_dim[FONTNAME_CODE].set = true;
break;
}
@@ -616,7 +618,7 @@ static ttf_cmap_entry *ttf_read_cmap(char *ttf_name, int pid, int eid,
p->ttf_name = xstrdup(ttf_name);
p->pid = pid;
p->eid = eid;
- p->table = xtalloc(0x10000, short);
+ p->table = xtalloc(0x10000, long);
for (i = 0; i < 0x10000; ++i)
p->table[i] = -1; /* unassigned yet */
@@ -663,7 +665,7 @@ static ttf_cmap_entry *ttf_read_cmap(char *ttf_name, int pid, int eid,
if (p->table[i] != -1)
pdftex_warn
("cmap: multiple glyphs are mapped to unicode %.4lX, "
- "only %i will be used (glyph %li being ignored)", i,
+ "only %li will be used (glyph %li being ignored)", i,
p->table[i], index);
else
p->table[i] = index;
@@ -846,9 +848,10 @@ static void ttf_write_cmap(void)
static int prepend_subset_tags(int index, char *p)
{
- const boolean is_unicode = (name_tab[index].platform_id == 3);
+ boolean is_unicode;
int i;
assert(index >= 0 && index < name_record_num && fd_cur->subset_tag != NULL);
+ is_unicode = (name_tab[index].platform_id == 3);
if (is_unicode) {
for (i = 0; i < 6; ++i) {
*p++ = 0;
@@ -1025,7 +1028,7 @@ static void ttf_reindex_glyphs(void)
ttfenc_entry *e;
glyph_entry *glyph;
int index;
- short *t;
+ long *t;
ttf_cmap_entry *cmap = NULL;
boolean cmap_not_found = false;
@@ -1098,7 +1101,7 @@ static void ttf_reindex_glyphs(void)
if (t[index] != -1) {
if (t[index] >= glyphs_count) {
pdftex_warn
- ("`%s' is mapped to index %i which is out of valid range [0..%i)",
+ ("`%s' is mapped to index %li which is out of valid range [0..%i)",
e->name, t[index], glyphs_count);
continue;
}