Page 1 of 1
SVG ArialMT Unicode issue
Posted: Thu Jan 07, 2016 2:56 pm
by lagivan
Hello,
I'm facing an Unicode issue inside an SVG that is referenced from my DITA content. In general Unicode works fine everywhere except the SVG. Thus, I have 'Unicode Arial MS' installed properly and FOP uses it successfully. The SVG contains the following code:
Code: Select all
<text transform="matrix(1 0 0 1 411.8486 116.5684)" font-family="'ArialMT'" font-size="7" style="-inkscape-font-specification:'Arial Unicode MS, Normal';font-family:'Arial Unicode MS';font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:6.99999988px;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;" id="text3642" sodipodi:linespacing="125%">δ =</text>
The font-family ArialMT seems to be the cause of the issue. If I change it to Arial, the Unicode character is rendered correctly, otherwise it's rendered as #.
I've tried the following approaches unsuccessfully:
- specifying ArialMT font-triplet in fop.xconf:
Code: Select all
<font kerning="yes" embed-url="c:\Windows\Fonts\ARIALUNI.ttf">
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
- adding substitution for ArialMT in fop.xconf:
Code: Select all
<substitutions>
<substitution>
<from font-family="ArialMT"/>
<to font-family="Arial"/>
</substitution>
</substitutions>
Any ideas how I can solve it?
Thanks,
Ivan
Re: SVG ArialMT Unicode issue
Posted: Thu Jan 07, 2016 4:14 pm
by Radu
Hi Ivan,
Did you make any font-related customizations to the DITA to PDF output?
A couple of things you should check:
1) If the
fop.xconf contains the
<auto-detect/> tag inside, it should auto-detect all fonts in the
c:\Windows\Fonts\. In your case the "arialuni.ttf" font's original name should be "Arial Unicode MS". So (at least for tests) you could use that original name in the font-family attribute instead of
ArialMT in the SVG.
2) Looking in your SVG, besides specifying the font-family to be
ArialMT, you also have a
style attribute which also specifies a font family name. Not sure which one gets applied in such cases.
If you cannot make this work you could try to send us a sample SVG + DITA topic (
support@oxygenxml.com) and we'll try to take a look at it.
Regards,
Radu
Re: SVG ArialMT Unicode issue
Posted: Tue Jan 12, 2016 6:25 pm
by lagivan
Hi Radu,
I reproduce the issue without any font-related customizations to DITA-OT.
<auto-detect/> is indeed specified (by default). I've tried to replace "ArialMT" with "Arial" and "Arial Unicode MS" - both variants work fine. However, I have no control over SVG content so I'd like to make ArialMT work fine by font family mapping or some other technique.
If I remove the style attribute, nothing changes. It seems this attribute is ignored in favour of font-family.
I've just sent a sample SVG + DITA topic as you suggested.
Regards,
Ivan
Re: SVG ArialMT Unicode issue
Posted: Wed Jan 13, 2016 11:12 am
by Dan
There is a problem in the Apache Batik SVG renderer with files created from Inkscape.
I removed the "-inkscape-font-specification:'Arial Unicode MS, Normal'" from the style attribute and it started to work, without any change to the font mappings.
I understand you have no control on how the SVG files are created, but maybe you can use the the oXygen refactoring capabilities to "fix" your SVGs.
You can:
1. Add your SVG files folder to the project
2. Right-Click on the folder and select "Refactoring/XML Refactoring"
3. Choose "Replace in attribute value"
4. Enter "text", "style", and your text to be removed/replaced: "-inkscape-font-specification:'Arial Unicode MS, Normal';"
5. Preview the changes and press finish.
I hope this helps.
Other problems with Inkscape files rendered in Batik:
https://issues.apache.org/jira/browse/BATIK-1112
Re: SVG ArialMT Unicode issue
Posted: Thu Jan 14, 2016 10:07 pm
by lagivan
Indeed I cannot really modify the SVGs. Dan suggests manual actions that I'd like to avoid. In a similar fashion I could simply replace "ArialMT" with "Arial" or "Arial Unicode MS". It'd solve the issue too. I'm wondering if there is any technique that would map one font-family to another so that there is no need to modify the content.
Re: SVG ArialMT Unicode issue
Posted: Fri Jan 15, 2016 10:47 am
by Dan
But even if you map the fonts to other ones using the FOP config, it will not solve the problem.
The Batik SVG processor will ignore all the properties following "-inkscape-font-specification", and will abort all other styling of the text, so it won't even interpret the font name attribute.
Re: SVG ArialMT Unicode issue
Posted: Fri Jan 15, 2016 11:42 am
by Dan
Sorry, my mistake, the font-family attribute is more important in this case and Batik is using it.
However, it seems that Batik looks only into the AWT(JRE) and system fonts, so it skips the substitutions from fop.xconf.
http://osdir.com/ml/fop-users-xmlgraphi ... 00045.html
http://markmail.org/message/j5cpns4dwyloyr2c
Maybe the solution is to duplicate the Arial font under ArialMT name and register it either in the JRE or in the system fonts..
Cheers,
Dan
Re: SVG ArialMT Unicode issue
Posted: Fri Jan 15, 2016 3:34 pm
by lagivan
Thanks, Dan! It's now clear.
I've decided to go on with your last suggestion. So I've duplicated Arial font under ArialMT name and installed it as a system one. It has indeed solved the issue.