You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2010/09/21 20:14:07 UTC

DO NOT REPLY [Bug 49968] New: [PATCH] Improve font matching

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

           Summary: [PATCH] Improve font matching
           Product: Batik
           Version: 1.8
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: GVT
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: jeremias@apache.org


Created an attachment (id=26061)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26061)
Patch to improve font matching

The attached patch does three things:

1. Internally register not only the font families but also the actual font
names (FontFamilyResolver).

Example: Where "Univers" is a font family, the font name "Univers 45 Light" is
not currently registered. So if this is used, no match is found and the
fallback "SansSerif" is used.

2. Handle all CSS font weights for Java VMs >= 1.5 (TextUtilities).

There was a simplification in place for handling cases in JVMs prior to 1.5.

3. Handle the case where a font family with spaces contains an integer value
(ex. "Univers 45 Light"), but is not in quotes (FontFamilyManager).

Until now, only the case style="font-family: Univers Bold" would be handled but
not style="font-family: Univers 45 Light".

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

--- Comment #2 from Thomas Deweese <de...@apache.org> 2010-09-22 05:43:44 EDT ---
Mostly I think it's fine, just for my understanding under strict CSS rules are
you allowed to have font families with numbers w/o quotes or underbars or
collapsed spaces?

Also it looks to me like this is left over from dev/debug:
@@ -170,6 +176,7 @@

             if (lu == null) {
                 return result;
             }
+            short v1 = lu.getLexicalUnitType();
             if (lu.getLexicalUnitType() != LexicalUnit.SAC_OPERATOR_COMMA) {
                 throw createInvalidLexicalUnitDOMException
                     (lu.getLexicalUnitType());

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rylleman@gmail.com

--- Comment #10 from Jeremias Maerki <je...@apache.org> 2012-02-23 13:51:07 UTC ---
*** Bug 52747 has been marked as a duplicate of this bug. ***

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

--- Comment #7 from Helder Magalhães <he...@gmail.com> 2010-10-04 11:54:20 EDT ---
(In reply to comment #6)
> *** Bug 48856 has been marked as a duplicate of this bug. ***

Bug 48856 comment 2 might be worth to take a look at, although I suspect
(without actually checking) that's what's being done already (within the
patch). :-)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

--- Comment #3 from Jeremias Maerki <je...@apache.org> 2010-09-22 07:59:07 EDT ---
It definitely fixes bug 44828, but I haven't looked closely at bug 46374, yet.
I have to dash of to Germany now and will be online again mid next week. I'll
take another look then.

Thanks, Thomas, for catching that little mistake. Eclipse was telling me about
it, but I've missed it nonetheless.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Helder Magalhães <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|GVT                         |GVT Text

--- Comment #1 from Helder Magalhães <he...@gmail.com> 2010-09-22 05:17:50 EDT ---
(In reply to comment #0)
> Created an attachment (id=26061)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26061) [details]
> Patch to improve font matching

Cool stuff. Thanks, Jeremias! ;-)


> 3. Handle the case where a font family with spaces contains an integer value
> (ex. "Univers 45 Light"), but is not in quotes (FontFamilyManager).

Does this mean that bug 44828 gets fixed by this as well? :-)


(from the patch)
+        //Also register all font names, not just font families.
+        //Example: Font Family: "Univers", but Font Name: "Univers 45 Light"
+        //Without this, matching "Univers 45 Light" is not possible.
+        Font[] allFonts = env.getAllFonts();
+        for (int i = 0; i < allFonts.length; i++) {
+            Font f = allFonts[i];
+            fonts.put(f.getFontName().toLowerCase(), f.getFontName());
+        }

Does this mean that bug 46374 gets fixed by this as well? :-)


Generally, the patch looks good to me. Thomas, could you also take a look and
state whether this is ready to land or if anything else is needed (tests for
regard, etc.)?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Helder Magalhães <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.a.joyce@gmail.com

--- Comment #5 from Helder Magalhães <he...@gmail.com> 2010-09-29 05:14:27 EDT ---
*** Bug 44828 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

--- Comment #8 from Helder Magalhães <he...@gmail.com> 2010-10-06 05:23:12 EDT ---
May this issue address bug 38207 as well?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

--- Comment #4 from Helder Magalhães <he...@gmail.com> 2010-09-29 01:18:23 EDT ---
(In reply to comment #2)
> Mostly I think it's fine, just for my understanding under strict CSS rules are
> you allowed to have font families with numbers w/o quotes or underbars or
> collapsed spaces?

Apparently the specifications are quite unclear regarding that [1] [2].
Nevertheless, there are couple links [3] [4] that hint towards that (allowing
numbers in font families) be formally specified in a near future. According to
what I was able to investigate, the underspecified behavior in the current
specs. make it even possible to use virtually any character (assuming proper
escaping, whenever needed). :-)

[1] http://www.w3.org/TR/CSS2/fonts.html#value-def-family-name
[2] http://www.w3.org/TR/css3-values/#font-families
[3] http://lists.w3.org/Archives/Public/www-style/2010Mar/0386.html
[4] http://wiki.csswg.org/spec/css2.1#issue-114

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |PatchAvailable

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Helder Magalhães <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |axel.brinkop@gmx.de

--- Comment #6 from Helder Magalhães <he...@gmail.com> 2010-10-04 11:52:29 EDT ---
*** Bug 48856 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 49968] [PATCH] Improve font matching

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49968

Jeremias Maerki <je...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Jeremias Maerki <je...@apache.org> 2011-03-22 11:25:27 EDT ---
Patch applied with the modification indicated by Thomas:
http://svn.apache.org/viewvc?rev=1084212&view=rev

Helder wrote: "May this issue address bug 38207 as well?"
I don't know but it sounds like something different. My change is confined to
the FontFamilyManager.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org