Skip to content

Commit

Permalink
[11_42] Distinguish smart font for math and for prog
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii committed Nov 17, 2024
1 parent ca060c3 commit 9a3125f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src/Graphics/Fonts/font.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,12 @@ font math_font (scheme_tree t, font base_fn, font error_fn, double zoomx,
font compound_font (scheme_tree def, double zoomx, double zoomy);
font smart_font (string family, string variant, string series, string shape,
int sz, int dpi);
font smart_font (string family, string variant, string series, string shape,
string tf, string tv, string tw, string ts, int sz, int dpi);
font math_smart_font (string family, string variant, string series,
string shape, string tf, string tv, string tw, string ts,
int sz, int dpi);
font prog_smart_font (string family, string variant, string series,
string shape, string tf, string tv, string tw, string ts,
int sz, int dpi);
font apply_effects (font fn, string effects);

int script (int sz, int level);
Expand Down
16 changes: 13 additions & 3 deletions src/Graphics/Fonts/smart_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,9 +1709,9 @@ smart_font (string family, string variant, string series, string shape, int sz,
}

font
smart_font (string family, string variant, string series, string shape,
string tfam, string tvar, string tser, string tsh, int sz,
int dpi) {
math_smart_font (string family, string variant, string series, string shape,
string tfam, string tvar, string tser, string tsh, int sz,
int dpi) {
if (tfam == "roman" || starts (tfam, "sys-")) {
tfam= family;
}
Expand All @@ -1723,6 +1723,16 @@ smart_font (string family, string variant, string series, string shape,
return smart_font (tfam, tvar, tser, tsh, sz, dpi);
}

font
prog_smart_font (string family, string variant, string series, string shape,
string tfam, string tvar, string tser, string tsh, int sz,
int dpi) {
if (tfam == "roman" || starts (tfam, "sys-")) {
tfam= family;
}
return smart_font (tfam, tvar, tser, tsh, sz, dpi);
}

static string
get_string_parameter (string val, int i, string def) {
array<string> a= trimmed_tokenize (val, ";");
Expand Down
22 changes: 12 additions & 10 deletions src/Typeset/Env/env_semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,18 +546,20 @@ edit_env_rep::update_font () {
get_script_size (fn_size, index_level), (int) (magn * dpi));
break;
case 2:
fn= smart_font (get_string (MATH_FONT), get_string (MATH_FONT_FAMILY),
get_string (MATH_FONT_SERIES), get_string (MATH_FONT_SHAPE),
get_string (FONT), get_string (FONT_FAMILY),
get_string (FONT_SERIES), "mathitalic",
get_script_size (fn_size, index_level), (int) (magn * dpi));
fn= math_smart_font (get_string (MATH_FONT), get_string (MATH_FONT_FAMILY),
get_string (MATH_FONT_SERIES),
get_string (MATH_FONT_SHAPE), get_string (FONT),
get_string (FONT_FAMILY), get_string (FONT_SERIES),
"mathitalic", get_script_size (fn_size, index_level),
(int) (magn * dpi));
break;
case 3:
fn= smart_font (get_string (PROG_FONT), get_string (PROG_FONT_FAMILY),
get_string (PROG_FONT_SERIES), get_string (PROG_FONT_SHAPE),
get_string (FONT), get_string (FONT_FAMILY) * "-tt",
get_string (FONT_SERIES), get_string (FONT_SHAPE),
get_script_size (fn_size, index_level), (int) (magn * dpi));
fn= prog_smart_font (
get_string (PROG_FONT), get_string (PROG_FONT_FAMILY),
get_string (PROG_FONT_SERIES), get_string (PROG_FONT_SHAPE),
get_string (FONT), get_string (FONT_FAMILY) * "-tt",
get_string (FONT_SERIES), get_string (FONT_SHAPE),
get_script_size (fn_size, index_level), (int) (magn * dpi));
break;
}
string eff= get_string (FONT_EFFECTS);
Expand Down

0 comments on commit 9a3125f

Please sign in to comment.