
On 11/28/05, Richard Hughes <cyreve@...400...> wrote:
My favoured solution would be both to fix the TTFs so that they use more standard names and to add the nonstandard names to Pango. Hopefully that way the problem would get fixed as quickly as possible for as many people as possible.
Both these approaches are good, but they are not the final solution. First, you'll never be able to cover all possible synonyms, especially given that some fonts use non-English names of variants. Second, and more importantly, many professional fonts contain variants which are not expressible with CSS semantics at all - for example Swash, Outline, or Alternate. So if you try to convert that to CSS and then back, you will never get the same font because CSS simply does not have such font attributes. This is the subject of this long-standing bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=904962&grou...
Perhaps the easiest way to fix this is: On font assignment, check if the variant name is "standard" and is going to be translated into CSS without loss. In that case, do nothing as now. Otherwise, store the complete font name (family + variant) in the "font-family:" property, approximating other properties as best we can. Then on reading the SVG, see if the font-family matches any available family. If not, try to interpret it as family + variant. (This is just a rough outline; it's been long since I looked into that code, but I think this should work. Alternatively, we can add a custom CSS property for storing exact family+variant, but this will be much more cumbersome to implement.)
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org