]> git.lyx.org Git - features.git/blobdiff - src/FontInfo.cpp
Since LyX uses "INHERIT" as a default, we do not want it for HTML.
[features.git] / src / FontInfo.cpp
index 78655aeecfebd06535c26904e4eb9578fc1abbc1..491ebf3885c6e653924a46c37024227bd3104a84 100644 (file)
@@ -333,32 +333,49 @@ namespace {
        }
 
 
-       string getFamily(FontFamily const & f)
+       string getFamilyCSS(FontFamily const & f)
        {
                switch (f) {
-               case ROMAN_FAMILY: return "serif";
-               case SANS_FAMILY: return "sans-serif";
-               case TYPEWRITER_FAMILY: return "monospace";
-               case INHERIT_FAMILY: return "inherit";
-               default: break;
+               case ROMAN_FAMILY: 
+                       return "serif";
+               case SANS_FAMILY: 
+                       return "sans-serif";
+               case TYPEWRITER_FAMILY: 
+                       return "monospace";
+               case SYMBOL_FAMILY:
+               case CMR_FAMILY:
+               case CMSY_FAMILY:
+               case CMM_FAMILY:
+               case CMEX_FAMILY:
+               case MSA_FAMILY:
+               case MSB_FAMILY:
+               case EUFRAK_FAMILY:
+               case WASY_FAMILY:
+               case ESINT_FAMILY:
+               case INHERIT_FAMILY:
+               case IGNORE_FAMILY:
+                       break;
                }
                return "";
        }
 
 
-       string getSeries(FontSeries const & s)
+       string getSeriesCSS(FontSeries const & s)
        {
                switch (s) {
-               case MEDIUM_SERIES: return "normal";
-               case BOLD_SERIES: return "bold";
-               case INHERIT_SERIES: return "inherit";
-               default: break;
+               case MEDIUM_SERIES: 
+                       return "normal";
+               case BOLD_SERIES: 
+                       return "bold";
+               case INHERIT_SERIES:
+               case IGNORE_SERIES:
+                 break;
                }
                return "";
        }
 
 
-       string getShape(FontShape const & s)
+       string getShapeCSS(FontShape const & s)
        {
                string fs = "normal";
                string fv = "normal";
@@ -367,8 +384,9 @@ namespace {
                case ITALIC_SHAPE: fs = "italic"; break;
                case SLANTED_SHAPE: fs = "oblique"; break;
                case SMALLCAPS_SHAPE: fv = "small-caps"; break;
-               case INHERIT_SHAPE: fs = "inherit"; fv = "inherit"; break;
-               case IGNORE_SHAPE: fs = ""; fv = ""; break;
+               case IGNORE_SHAPE: 
+               case INHERIT_SHAPE:
+                       fs = ""; fv = ""; break;
                }
                string retval;
                if (!fs.empty())
@@ -379,25 +397,34 @@ namespace {
        }
 
 
-       string getSize(FontSize const & s)
+       string getSizeCSS(FontSize const & s)
        {
                switch (s) {
-               case FONT_SIZE_TINY: return "xx-small";
-               case FONT_SIZE_SCRIPT: return "x-small";
+               case FONT_SIZE_TINY: 
+                       return "xx-small";
+               case FONT_SIZE_SCRIPT: 
+                       return "x-small";
                case FONT_SIZE_FOOTNOTE: 
-               case FONT_SIZE_SMALL: return "small";
-               case FONT_SIZE_NORMAL: return "medium";
-               case FONT_SIZE_LARGE: return "large";
+               case FONT_SIZE_SMALL: 
+                       return "small";
+               case FONT_SIZE_NORMAL: 
+                       return "medium";
+               case FONT_SIZE_LARGE: 
+                       return "large";
                case FONT_SIZE_LARGER: 
-               case FONT_SIZE_LARGEST: return "x-large";
+               case FONT_SIZE_LARGEST: 
+                       return "x-large";
                case FONT_SIZE_HUGE: 
-               case FONT_SIZE_HUGER: return "xx-large";
-               case FONT_SIZE_INCREASE: return "larger";
-               case FONT_SIZE_DECREASE: return "smaller";
-               case FONT_SIZE_INHERIT: return "inherit";
-               case FONT_SIZE_IGNORE: return "";
+               case FONT_SIZE_HUGER: 
+                       return "xx-large";
+               case FONT_SIZE_INCREASE: 
+                       return "larger";
+               case FONT_SIZE_DECREASE: 
+                       return "smaller";
+               case FONT_SIZE_IGNORE: 
+               case FONT_SIZE_INHERIT: 
+                               break;
                }       
-               // squash warning
                return "";
        }
        
@@ -408,14 +435,14 @@ namespace {
 docstring FontInfo::asCSS() const 
 {
        string retval;
-       string tmp = getFamily(family_);
+       string tmp = getFamilyCSS(family_);
        if (!tmp.empty())
                appendSep(retval, makeCSSTag("font-family", tmp));
-       tmp = getSeries(series_);
+       tmp = getSeriesCSS(series_);
        if (!tmp.empty())
-               appendSep(retval, makeCSSTag("font-series", tmp));
-       appendSep(retval, getShape(shape_));
-       tmp = getSize(size_);
+               appendSep(retval, makeCSSTag("font-weight", tmp));
+       appendSep(retval, getShapeCSS(shape_));
+       tmp = getSizeCSS(size_);
        if (!tmp.empty())
                appendSep(retval, makeCSSTag("font-size", tmp));
        return from_ascii(retval);