https://issues.apache.org/bugzilla/show_bug.cgi?id=50605

--- Comment #2 from brian m. carlson <sand...@crustytoothpaste.net> 2011-01-17 
17:44:29 EST ---
I've narrowed down the problem to the call to overridePrimaryEncoding on line
422 of Type1FontLoader.java.  Commenting this line out seems to solve the
problem.

This function (overridePrimaryEncoding) iterates over the set of metrics and
sets a character code for each one based on the mapping passed in.  However,
two different characters are mapped to 0x2d: U+002D and U+2212.  Of course, the
metrics for U+2212 are different than those for U+002D; the former is wider
than the latter.  When layout occurs, the incorrect metrics are used and
consequently, a gap occurs.

I think the sensible thing to do here is not to map U+2212 onto U+002D. 
Attached is a patch that does exactly that.  When we call
overridePrimaryEncoding, the encoding is always a single byte.  The patch
creates an array of 256 elements.  When we map a character to a byte value, we
store the given character value into the array (indexed by the byte value) and
make the mapping.  Next time we have a mapping to the same byte value, we do
nothing.  And by nothing, I mean nothing.  We do not map it onto the given byte
value (because that breaks things, as I've demonstrated) and we do not map it
onto -1 (because then the next glyph is rendered over the top of this one).  We
simply do nothing.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to