support for the kurier sansserif fonts

- fileformat change
This commit is contained in:
Uwe Stöhr 2013-02-11 00:47:09 +01:00
parent a69fcde072
commit 487d3bffab
5 changed files with 139 additions and 7 deletions

View File

@ -409,6 +409,7 @@
\TestPackage{fourier}
\TestPackage{garamondx}
\TestFont[zgmr8r]{garamondx-fonts}
\TestPackage{kurier}
\TestPackage{lh-lcy}
\TestPackage{libertine}
\TestPackage{libertine-type1}

View File

@ -442,6 +442,46 @@ Font helvet
Requires psnfss
EndFont
Font kurier
GuiName "Kurier"
Family sf
SwitchDefault 1
Preamble
\renewcommand{\bfdefault}{b}
EndPreamble
EndFont
Font kurierl
GuiName "Kurier (light)"
Family sf
SwitchDefault 1
Preamble
\renewcommand{\bfdefault}{b}
EndPreamble
EndFont
Font kurier-condensed
GuiName "Kurier (condensed)"
Family sf
Requires kurier
Preamble
\renewcommand{\sfdefault}{kurier}
\edef\sfdefault{\sfdefault c}
\renewcommand{\bfdefault}{b}
EndPreamble
EndFont
Font kurier-light-condensed
GuiName "Kurier (light condensed)"
Family sf
Requires kurier
Preamble
\renewcommand{\sfdefault}{kurierl}
\edef\sfdefault{\sfdefault c}
\renewcommand{\bfdefault}{b}
EndPreamble
EndFont
Font lmss
GuiName "Latin Modern Sans"
Family sf
@ -547,6 +587,17 @@ Font garamondx-ntxm
Provides amssymb,amsfonts
EndFont
Font kurier-math
GuiName "Kurier (math)"
Family math
Requires kurier
Preamble
\let\Myrmdefault\rmdefault
\usepackage[math]{kurier}
\renewcommand{\rmdefault}{\Myrmdefault}
EndPreamble
EndFont
Font libertine-ntxm
GuiName "Libertine (New TX)"
Family math

View File

@ -3528,6 +3528,50 @@ def revert_IEEEtran_3(document):
return
def revert_kurier_fonts(document):
" Revert kurier font definition to LaTeX "
i = find_token(document.header, "\\font_math", 0)
if i != -1:
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
val = get_value(document.header, "\\font_math", i)
if val == "kurier-math":
add_to_preamble(document, "\\let\\Myrmdefault\\rmdefault\n" \
"\\usepackage[math]{kurier}\n" \
"\\renewcommand{\\rmdefault}{\\Myrmdefault}")
document.header[i] = "\\font_math auto"
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
k = find_token(document.header, "\\font_sans kurierl", 0)
if k != -1:
add_to_preamble(document, "\\renewcommand{\\sfdefault}{kurierl}\n" \
"\\renewcommand{\\bfdefault}{b}")
document.header[k] = "\\font_sans default"
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
l = find_token(document.header, "\\font_sans kurier-condensed", 0)
if l != -1:
add_to_preamble(document, "\\renewcommand{\\sfdefault}{kurier}\n" \
"\\edef\\sfdefault{\\sfdefault c}\n" \
"\\renewcommand{\\bfdefault}{b}")
document.header[l] = "\\font_sans default"
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
m = find_token(document.header, "\\font_sans kurier-light-condensed", 0)
if m != -1:
add_to_preamble(document, "\\renewcommand{\\sfdefault}{kurierl}\n" \
"\\edef\\sfdefault{\\sfdefault c}\n" \
"\\renewcommand{\\bfdefault}{b}")
document.header[m] = "\\font_sans default"
if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
j = find_token(document.header, "\\font_sans kurier", 0)
if j != -1:
add_to_preamble(document, "\\renewcommand{\\sfdefault}{kurier}\n" \
"\\renewcommand{\\bfdefault}{b}")
document.header[j] = "\\font_sans default"
##
# Conversion hub
#
@ -3580,10 +3624,12 @@ convert = [
[457, [convert_use_stackrel]],
[458, [convert_captioninsets, convert_captionlayouts]],
[459, []],
[460, []]
[460, []],
[461, []]
]
revert = [
[460, [revert_kurier_fonts]],
[459, [revert_IEEEtran_3]],
[458, [revert_fragileframe, revert_newframes]],
[457, [revert_captioninsets, revert_captionlayouts]],

View File

@ -128,7 +128,10 @@ const char * const known_roman_fonts[] = { "ae", "beraserif", "bookman",
"mathptmx", "newcent", "utopia", 0};
const char * const known_sans_fonts[] = { "avant", "berasans", "cmbr", "cmss",
"helvet", "lmss", 0};
"helvet", "kurier", "kurierl", "lmss", 0};
const char * const known_kurier_fonts[] = { "kurier", "kurierl", "kurier-condensed",
"kurier-light-condensed", 0};
const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
"courier", "lmtt", "luximono", "fourier", "lmodern", "mathpazo", "mathptmx",
@ -1332,22 +1335,36 @@ void Preamble::parse(Parser & p, string const & forceclass,
string const opt1 = p.getFullOpt();
string const opt2 = p.getFullOpt();
string const body = p.verbatim_item();
// store the in_lyx_preamble setting
bool const was_in_lyx_preamble = in_lyx_preamble;
// font settings
if (name == "\\rmdefault")
if (is_known(body, known_roman_fonts))
if (is_known(body, known_roman_fonts)) {
h_font_roman = body;
in_lyx_preamble = true;
}
if (name == "\\sfdefault")
if (is_known(body, known_sans_fonts))
if (is_known(body, known_sans_fonts)) {
h_font_sans = body;
in_lyx_preamble = true;
}
if (name == "\\ttdefault")
if (is_known(body, known_typewriter_fonts))
if (is_known(body, known_typewriter_fonts)) {
h_font_typewriter = body;
in_lyx_preamble = true;
}
if (name == "\\familydefault") {
string family = body;
// remove leading "\"
h_font_default_family = family.erase(0,1);
in_lyx_preamble = true;
}
if (name == "\\bfdefault")
// LyX re-adds this if a kurier font is used
if (is_known(h_font_sans, known_kurier_fonts) && body == "b")
in_lyx_preamble = true;
// remove the lyxdot definition that is re-added by LyX
// if necessary
if (name == "\\lyxdot")
@ -1371,6 +1388,23 @@ void Preamble::parse(Parser & p, string const & forceclass,
<< opts << "{" << body << "}";
*/
}
// restore the in_lyx_preamble setting
in_lyx_preamble = was_in_lyx_preamble;
}
else if (t.cs() == "edef"){
// we only support this for kurier fonts
string const command = p.next_token().asInput();
p.get_token();
if (command == "\\sfdefault") {
p.getArg('{', '}');
if (h_font_sans == "kurier")
h_font_sans = "kurier-condensed";
if (h_font_sans == "kurierl")
h_font_sans = "kurier-light-condensed";
}
else
h_preamble << "\\edef" << command << "{" << p.getArg('{', '}') << "}\n";
}
else if (t.cs() == "documentclass") {

View File

@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 460 // uwestoehr: new IEEE layouts
#define LYX_FORMAT_TEX2LYX 460 // uwestoehr: new IEEE layouts
#define LYX_FORMAT_LYX 461 // uwestoehr: support for the kurier fonts
#define LYX_FORMAT_TEX2LYX 461 // uwestoehr: support for the kurier fonts
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER