Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10508 closed defect (fixed)

Fix for font hex conversion in dojox.gfx.VectorText.js _decodeEntitySequence()

Reported by: mwarren Owned by: Tom Trenka
Priority: high Milestone: 1.5
Component: DojoX GFX Version: 1.4.0
Keywords: vector font VectorText.js Cc: Tom Trenka
Blocked By: Blocking:


SVG fonts with character that use a hex unicode name such as &x#ab; are not correctly decoded by dojo.gfx.VectorFont?._decodeEntitySequence(). Line 74 in revision 15318 of VectorText?.js ( ) can be changed like this to resolve the problem:

$ diff VectorText.js-15318 VectorText.js
<  tmp+=String.fromCharCode(     r[1].slice(2),16);
>  tmp+=String.fromCharCode("0x"+r[1].slice(2));

Change History (6)

comment:1 Changed 9 years ago by Tom Trenka

Owner: changed from Eugene Lazutkin to Tom Trenka

comment:2 Changed 9 years ago by mwarren

One workaround for this problem is changing the glyph unicode attributes within the SVG font file to use decimal encoding instead of hex. For example, the SVG glyph attribute unicode="&#xE000;" can be changed to unicode="&#57344;" to workaround this issue.

comment:3 Changed 9 years ago by mwarren

This perl commandline will convert hex unicode attributes into decimal attributes perl -pe 'if (m/unicode=\"&#(x[\da-f]+);/i){ $uni = "0".$1; $_ =~ s/$1/sprintf("%d",eval($uni))/e;}' MyOriginalFont-hex.svg > MyNewFont-decimal.svg

comment:4 Changed 9 years ago by Tom Trenka

Milestone: tbd1.5

comment:5 Changed 9 years ago by Tom Trenka

Resolution: fixed
Status: newclosed

(In [21654]) Fix the busted entity decoder. Fixes #10508 !strict.

comment:6 Changed 9 years ago by Tom Trenka

(In [21655]) Make sure we catch the undefined if an entity is not in the XmlEntityMap?. Refs #10508 !strict.

Note: See TracTickets for help on using tickets.