texlive[43721] Build/source/texk/dvipdfm-x: dvipdfm-x: Fix a bug in
commits+kakuto at tug.org
commits+kakuto at tug.org
Sun Apr 9 12:15:47 CEST 2017
Revision: 43721
http://tug.org/svn/texlive?view=revision&revision=43721
Author: kakuto
Date: 2017-04-09 12:15:46 +0200 (Sun, 09 Apr 2017)
Log Message:
-----------
dvipdfm-x: Fix a bug in vertical writing (from the author, S. Hirata)
Modified Paths:
--------------
trunk/Build/source/texk/dvipdfm-x/ChangeLog
trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog 2017-04-09 08:15:00 UTC (rev 43720)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog 2017-04-09 10:15:46 UTC (rev 43721)
@@ -1,3 +1,9 @@
+2017-04-09 Shunsaku Hirata <shunsaku.hirata74 at gmail.com>
+
+ * tt_cmap.c: Vertical writing support had been broken since at some
+ point of xdvipdfmx merge for "unicode" encoding. Apply vert/vrt2 GSUB
+ feature when generating Unicode mapping.
+
2017-03-18 Karl Berry <karl at tug.org>
* xbb.c: update copyright years.
Modified: trunk/Build/source/texk/dvipdfm-x/tt_cmap.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tt_cmap.c 2017-04-09 08:15:00 UTC (rev 43720)
+++ trunk/Build/source/texk/dvipdfm-x/tt_cmap.c 2017-04-09 10:15:46 UTC (rev 43721)
@@ -612,7 +612,7 @@
static void
load_cmap4 (struct cmap4 *map,
- unsigned char *GIDToCIDMap, CMap *cmap)
+ unsigned char *GIDToCIDMap, otl_gsub *gsub_list, CMap *cmap)
{
USHORT c0, c1, gid, cid;
USHORT j, d, segCount;
@@ -628,19 +628,20 @@
ch = c0 + j;
if (map->idRangeOffset[i] == 0) {
gid = (ch + map->idDelta[i]) & 0xffff;
- } else if (c0 == 0xffff && c1 == 0xffff && map->idRangeOffset[i] == 0xffff) {
+ } else if (c0 == 0xffff && c1 == 0xffff &&
+ map->idRangeOffset[i] == 0xffff) {
/* this is for protection against some old broken fonts... */
gid = 0;
} else {
- gid = (map->glyphIndexArray[j+d] +
- map->idDelta[i]) & 0xffff;
+ gid = (map->glyphIndexArray[j+d] + map->idDelta[i]) & 0xffff;
}
if (gid != 0 && gid != 0xffff) {
+ if (gsub_list)
+ otl_gsub_apply(gsub_list, &gid);
if (GIDToCIDMap) {
cid = ((GIDToCIDMap[2*gid] << 8)|GIDToCIDMap[2*gid+1]);
if (cid == 0)
- WARN("GID %u does not have corresponding CID %u.",
- gid, cid);
+ WARN("GID %u does not have corresponding CID %u.", gid, cid);
} else {
cid = gid;
}
@@ -658,7 +659,7 @@
static void
load_cmap12 (struct cmap12 *map,
- unsigned char *GIDToCIDMap, CMap *cmap)
+ unsigned char *GIDToCIDMap, otl_gsub *gsub_list, CMap *cmap)
{
ULONG i, ch; /* LONG ? */
USHORT gid, cid;
@@ -669,6 +670,8 @@
ch++) {
int d = ch - map->groups[i].startCharCode;
gid = (USHORT) ((map->groups[i].startGlyphID + d) & 0xffff);
+ if (gsub_list)
+ otl_gsub_apply(gsub_list, &gid);
if (GIDToCIDMap) {
cid = ((GIDToCIDMap[2*gid] << 8)|GIDToCIDMap[2*gid+1]);
if (cid == 0)
@@ -1594,7 +1597,7 @@
static int
load_base_CMap (const char *cmap_name, int wmode,
- CIDSysInfo *csi, unsigned char *GIDToCIDMap,
+ CIDSysInfo *csi, unsigned char *GIDToCIDMap, otl_gsub *gsub_list,
tt_cmap *ttcmap)
{
int cmap_id;
@@ -1616,9 +1619,9 @@
}
if (ttcmap->format == 12) {
- load_cmap12(ttcmap->map, GIDToCIDMap, cmap);
+ load_cmap12(ttcmap->map, GIDToCIDMap, gsub_list, cmap);
} else if (ttcmap->format == 4) {
- load_cmap4(ttcmap->map, GIDToCIDMap, cmap);
+ load_cmap4(ttcmap->map, GIDToCIDMap, gsub_list, cmap);
}
cmap_id = CMap_cache_add(cmap);
@@ -1893,11 +1896,30 @@
}
}
}
+ if (wmode == 1) {
+ gsub_list = otl_gsub_new();
+ if (otl_gsub_add_feat(gsub_list, "*", "*", "vrt2", sfont) < 0) {
+ if (otl_gsub_add_feat(gsub_list, "*", "*", "vert", sfont) < 0) {
+ WARN("GSUB feature vrt2/vert not found.");
+ otl_gsub_release(gsub_list);
+ gsub_list = NULL;
+ } else {
+ otl_gsub_select(gsub_list, "*", "*", "vert");
+ }
+ } else {
+ otl_gsub_select(gsub_list, "*", "*", "vrt2");
+ }
+ } else {
+ gsub_list = NULL;
+ }
cmap_id = load_base_CMap(base_name, wmode,
- (is_cidfont ? &csi : NULL),
- GIDToCIDMap, ttcmap);
+ (is_cidfont ? &csi : NULL), GIDToCIDMap,
+ gsub_list, ttcmap);
if (cmap_id < 0)
ERROR("Failed to read OpenType/TrueType cmap table.");
+ if (gsub_list)
+ otl_gsub_release(gsub_list);
+ gsub_list = NULL;
if (!otl_tags) {
RELEASE(cmap_name);
More information about the tex-live-commits
mailing list