Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11_42] Distinguish smart font for math and for prog #2176

Merged
merged 2 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added TeXmacs/fonts/opentype/Asana-Math.otf
Binary file not shown.
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
Loading