Re: Does a font family with a period in it need apos around it?

Randall Parker wrote:
> 
> I'm trying to figure out whether Adobe SVGViewer or Apache Batik has a
> bug with
> the handling of font family names. I'm hoping someone here can say
> whether
> a font family name with a period in it (eg sansserif.italic) should be
> 
> quoted by apostrophes.

Firstly, quoting is never wrong.

Secondly, there is perhaps the potential for confusion as sans-serif is
a reserved name for a generic font family and is thus never quoted.
However, I would expect the hyphen to be sufficient disambiguation
there. *Unless* the implementation tries to compact strings by making
them all the same case, removing spaces or other punctuation, removing
vowels, etc (there was an SVG implementation which did this, no longer
in widespread use).


> I have an SVG file output by Batik that the Batik Viewer can view but
> that the Adobe SVG Viewer can't view.
> 
> It appeas that Adobe's SVGViewer considers this line to be bad because
> of the .italic as part of the font family name:
> 
> <font-face ascent="100.52667" descent="21.970367" units-per-em="100"
> style="font-family:sansserif.italic; font-style:italic;
> font-weight:normal;" />
> 
> Changing to
> font-family:sansserif;
> removes the bad CSS error that SVGViewer reports as an IE plug-in:
> bad CSS property or descriptor declaration

OK but does it make it use that font, or just stop complaining about its
syntax?

> 
> I noticed something else too. There were three occurrences of
> sansserif.italic. The later 2 were in text tags:
> 
> <text x="227.9677734375" y="254.92665100097656" style="font-size:12;
> font-family:&apos;sansserif.italic&apos;; font-style:italic;
> stroke:none;">
> 
> Note that they have the ampersand apostrophes around them. So then I
> changed the font-face font-family attribute to have the ampersand
> apostrophe

That makes no difference. These predefined entities like &amp; &lt; etc
get converted to & < etc during parsing. You could just as easily put  '
instead of &apos; - clearly though, you can't nest " inside ".

> 
> <font-face ascent="100.52667" descent="21.970367" units-per-em="100"
> style="font-family:
> &apos;sansserif.italic&apos;; font-style:italic; font-weight:normal;"
> />
> 
> Now SVGViewer no longer generates an error message about this SVG
> file.

That is worrying. It implies a string match on the unparsed string.

> So is it a bug in Batik for the font-face font-family to not put the
> apos chars around a font family that has a dot in the middle of it? 

No. But I would suggest that font family names always be quoted. It does
no harm, and is never wrong. When used inside an xml attribute value, if
the attribute value is delimited by " use ' and if it is delimited by '
use ".

> Or is it a bug in Adobe SVG Viewer?

Possibly, needs more testing. But your two questions (is it a bug in
batik not to insert &apos; is it a bug in adobe) do not coverr all the
possibilities.
 
> Some relevant links to the specs. They don't say precisely enough what
> are legal
> font family names and when the font family names have to be quoted.
> They talk about white space. But since period is not white space then
> is the apos not needed?

Good catch, I will review this section. If it is ambiguous them the CSS
WG can discuss an appropriate clarification for the eratta.


-- 
Chris

Received on Monday, 20 August 2001 05:29:26 UTC