diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-07-04 22:07:54 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-07-04 22:07:54 +0000 |
commit | ab399d16f49b986d1de514b2fb8434872decf91d (patch) | |
tree | 6d3d0faca673d7aa1c0f48ca679ce7841a82e3df /Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp | |
parent | dd2749b37f7b6a9976869e29a028eeab80d686df (diff) |
dvisvgm 1.16
git-svn-id: svn://tug.org/texlive/trunk@41628 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp index 665d874de19..d6f97eb0377 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/JFM.cpp @@ -31,44 +31,46 @@ using namespace std; JFM::JFM (istream &is) { is.seekg(0); - StreamReader sr(is); - UInt16 id = UInt16(sr.readUnsigned(2)); // JFM ID (9 or 11) + StreamReader reader(is); + UInt16 id = UInt16(reader.readUnsigned(2)); // JFM ID (9 or 11) if (id != 9 && id != 11) { ostringstream oss; oss << "invalid JFM identifier " << id << " (9 or 11 expected)"; throw FontMetricException(oss.str()); } _vertical = (id == 9); - UInt16 nt = UInt16(sr.readUnsigned(2)); // length of character type table - UInt16 lf = UInt16(sr.readUnsigned(2)); // length of entire file in 4 byte words - UInt16 lh = UInt16(sr.readUnsigned(2)); // length of header in 4 byte words - UInt16 bc = UInt16(sr.readUnsigned(2)); // smallest character code in font - UInt16 ec = UInt16(sr.readUnsigned(2)); // largest character code in font - UInt16 nw = UInt16(sr.readUnsigned(2)); // number of words in width table - UInt16 nh = UInt16(sr.readUnsigned(2)); // number of words in height table - UInt16 nd = UInt16(sr.readUnsigned(2)); // number of words in depth table - UInt16 ni = UInt16(sr.readUnsigned(2)); // number of words in italic corr. table - UInt16 nl = UInt16(sr.readUnsigned(2)); // number of words in glue/kern table - UInt16 nk = UInt16(sr.readUnsigned(2)); // number of words in kern table - UInt16 ng = UInt16(sr.readUnsigned(2)); // number of words in glue table - UInt16 np = UInt16(sr.readUnsigned(2)); // number of font parameter words + UInt16 nt = UInt16(reader.readUnsigned(2)); // length of character type table + UInt16 lf = UInt16(reader.readUnsigned(2)); // length of entire file in 4 byte words + UInt16 lh = UInt16(reader.readUnsigned(2)); // length of header in 4 byte words + UInt16 bc = UInt16(reader.readUnsigned(2)); // smallest character code in font + UInt16 ec = UInt16(reader.readUnsigned(2)); // largest character code in font + UInt16 nw = UInt16(reader.readUnsigned(2)); // number of words in width table + UInt16 nh = UInt16(reader.readUnsigned(2)); // number of words in height table + UInt16 nd = UInt16(reader.readUnsigned(2)); // number of words in depth table + UInt16 ni = UInt16(reader.readUnsigned(2)); // number of words in italic corr. table + UInt16 nl = UInt16(reader.readUnsigned(2)); // number of words in glue/kern table + UInt16 nk = UInt16(reader.readUnsigned(2)); // number of words in kern table + UInt16 ng = UInt16(reader.readUnsigned(2)); // number of words in glue table + UInt16 np = UInt16(reader.readUnsigned(2)); // number of font parameter words if (7+nt+lh+(ec-bc+1)+nw+nh+nd+ni+nl+nk+ng+np != lf) throw FontMetricException("inconsistent length values"); setCharRange(bc, ec); - readHeader(sr); + readHeader(reader); is.seekg(28+lh*4); - readTables(sr, nt, nw, nh, nd, ni); + readTables(reader, nt, nw, nh, nd, ni); + is.seekg(4*(lf-np), ios::beg); + readParameters(reader, np); // JFM files provide 9 parameters but we don't need all of them } -void JFM::readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni) { +void JFM::readTables (StreamReader &reader, int nt, int nw, int nh, int nd, int ni) { // determine smallest charcode with chartype > 0 UInt16 minchar=0xFFFF, maxchar=0; for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)sr.readUnsigned(2); - UInt16 t = (UInt16)sr.readUnsigned(2); + UInt16 c = (UInt16)reader.readUnsigned(2); + UInt16 t = (UInt16)reader.readUnsigned(2); if (t > 0) { minchar = min(minchar, c); maxchar = max(maxchar, c); @@ -79,15 +81,15 @@ void JFM::readTables (StreamReader &sr, int nt, int nw, int nh, int nd, int ni) _minchar = minchar; _charTypeTable.resize(maxchar-minchar+1); memset(&_charTypeTable[0], 0, nt*sizeof(UInt16)); - sr.seek(-nt*4, ios::cur); + reader.seek(-nt*4, ios::cur); for (int i=0; i < nt; i++) { - UInt16 c = (UInt16)sr.readUnsigned(2); - UInt16 t = (UInt16)sr.readUnsigned(2); + UInt16 c = (UInt16)reader.readUnsigned(2); + UInt16 t = (UInt16)reader.readUnsigned(2); if (c >= minchar) _charTypeTable[c-minchar] = t; } } - TFM::readTables(sr, nw, nh, nd, ni); + TFM::readTables(reader, nw, nh, nd, ni); } |