Erikhht / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

ITextRenderer FontResolver is case-sensitive on font names #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a html page with using these style definition: 
   p.correct { font-family: Verdana; } 
   p.wrong { font-family: verdana; } 
   please note the lowercased "v" in .wrong class

2. Load the proper font (Verdana.ttf) with ITextFontResolver.addFontDirectory 
(or ITextFontResolver.addFont())

3. Make a pdf with ITextRenderer.

What is the expected output? What do you see instead?
The <p> with .correct class will be correctly rendered with Verdana font, the 
others with .wrong class will fall back to Arial (or whatever it is).
Note that in web browser the font family name is case-insensitive.

What version of the product are you using? On what operating system?
The problem is still present in R8 release.

Please provide any additional information below.
I wrote a patch that use a lowercased version of the font name as key for 
_fontFamilies Hashmap in ITextFontResolver.java. In my tests the patch works 
without problems.

Original issue reported on code.google.com by i.dasto...@gmail.com on 22 Feb 2011 at 10:59

Attachments:

GoogleCodeExporter commented 9 years ago
You dont even need to lower case replace the HashMap with a 
TreeMap(String.CASE_INSENSITIVE_COMPARATOR) and then case doesnt matter.

Original comment by miroslav...@gmail.com on 13 Apr 2011 at 6:06