summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2007-11-13 10:45:44 +0000
committerTor Andersson <tor.andersson@artifex.com>2007-11-13 10:45:44 +0000
commit5063a9acf649c4adbf47cc5d88c212ab03cbf7b0 (patch)
treedc9f210ed264ca3d22541ddf98d1c784ffe5eab4
parent4a2a09c85a4e311f2fec678445f2d9f7c4ebcd35 (diff)
Constant vigilance! Never trust a default.
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@2945 06663e23-700e-0410-b217-a244a6096597
-rw-r--r--xps/ghostxps.h1
-rw-r--r--xps/xpsttf.c20
2 files changed, 19 insertions, 2 deletions
diff --git a/xps/ghostxps.h b/xps/ghostxps.h
index 752189a9a..9c56cf385 100644
--- a/xps/ghostxps.h
+++ b/xps/ghostxps.h
@@ -317,6 +317,7 @@ int xps_fill_font_glyph(xps_context_t *ctx, xps_font_t *font, int gid, float x,
int xps_find_sfnt_table(xps_font_t *font, char *name, int *lengthp);
int xps_load_sfnt_cmap(xps_font_t *font);
+int xps_load_sfnt_name(xps_font_t *font, char *namep);
int xps_init_truetype_font(xps_context_t *ctx, xps_font_t *font);
int xps_init_postscript_font(xps_context_t *ctx, xps_font_t *font);
diff --git a/xps/xpsttf.c b/xps/xpsttf.c
index e0c0ca6e8..7571439a5 100644
--- a/xps/xpsttf.c
+++ b/xps/xpsttf.c
@@ -63,6 +63,13 @@ static const char *pl_mac_names[258] = {
* truetype (loca/glyf) flavored opentypes.
*/
+static unsigned int
+xps_true_get_glyph_index(gs_font_type42 *pfont42, gs_glyph glyph)
+{
+ /* identity */
+ return glyph;
+}
+
static int
xps_true_callback_string_proc(gs_font_type42 *p42, ulong offset, uint length, const byte **pdata)
{
@@ -76,11 +83,14 @@ xps_true_callback_string_proc(gs_font_type42 *p42, ulong offset, uint length, co
return 0;
}
+static gs_char xps_last_char = GS_NO_CHAR; /* same hack as in PCL */
+
static gs_glyph
xps_true_callback_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t spc)
{
xps_font_t *font = pfont->client_data;
int value;
+ xps_last_char = chr; /* save the char we're encoding for the decode_glyph hack */
value = xps_encode_font_char(font, chr);
if (value == 0)
return gs_no_glyph;
@@ -88,9 +98,13 @@ xps_true_callback_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t spc)
}
static gs_char
-xps_true_callback_decode_glyph(gs_font *p42, gs_glyph glyph)
+xps_true_callback_decode_glyph(gs_font *pfont, gs_glyph glyph)
{
- return GS_NO_CHAR;
+ /* We should do a reverse cmap lookup here to match PS/PDF. */
+ /* However, a complete rearchitecture of our text and font processing
+ * would be necessary to match XPS unicode mapping with the
+ * cluster maps. Alas, we cheat similarly to PCL. */
+ return xps_last_char;
}
static int
@@ -353,7 +367,9 @@ int xps_init_truetype_font(xps_context_t *ctx, xps_font_t *font)
p42->data.string_proc = xps_true_callback_string_proc;
p42->data.proc_data = font;
+
gs_type42_font_init(p42, font->subfontid);
+ p42->data.get_glyph_index = xps_true_get_glyph_index;
}
gs_definefont(ctx->fontdir, font->font);