"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Graphics/Fonts/find_font.cpp" between
TeXmacs-1.99.4-src.tar.gz and TeXmacs-1.99.5-src.tar.gz

About: GNU TeXmacs is a what-you-see-is-what-you-get scientific text editor, which was both inspired by TeX and GNU Emacs.

find_font.cpp  (TeXmacs-1.99.4-src):find_font.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 80 skipping to change at line 80
} }
} }
font font
find_font_bis (tree t) { find_font_bis (tree t) {
// cout << "Find " << t << "\n"; // cout << "Find " << t << "\n";
if ((arity (t)==0) || is_compound (t[0])) return font (); if ((arity (t)==0) || is_compound (t[0])) return font ();
if (is_tuple (t, "compound")) if (is_tuple (t, "compound"))
return compound_font (t (1, N(t))); return compound_font (t (1, N(t)), 1.0, 1.0);
if (is_tuple (t, "truetype", 3)) if (is_tuple (t, "truetype", 3))
return tt_font (as_string (t[1]), as_int (t[2]), as_int (t[3])); return tt_font (as_string (t[1]), as_int (t[2]), as_int (t[3]));
if (is_tuple (t, "unicode", 3)) if (is_tuple (t, "unicode", 3))
return unicode_font (as_string (t[1]), as_int (t[2]), as_int (t[3])); return unicode_font (as_string (t[1]), as_int (t[2]), as_int (t[3]));
if (is_tuple (t, "unimath", 5)) { if (is_tuple (t, "unimath", 5)) {
font up= find_font (t[1]); font up= find_font (t[1]);
font it= find_font (t[2]); font it= find_font (t[2]);
skipping to change at line 178 skipping to change at line 178
font fn= find_font (t[1]); font fn= find_font (t[1]);
if (is_nil (fn)) return fn; if (is_nil (fn)) return fn;
return error_font (fn); return error_font (fn);
} }
if (is_tuple (t, "math", 4) && is_tuple (t[1]) && is_tuple (t[2])) { if (is_tuple (t, "math", 4) && is_tuple (t[1]) && is_tuple (t[2])) {
font fn= find_font (t[3]); font fn= find_font (t[3]);
if (is_nil (fn)) return fn; if (is_nil (fn)) return fn;
font error_fn= error_font (find_font (t[4])); font error_fn= error_font (find_font (t[4]));
if (is_nil (error_fn)) error_fn= error_font (fn); if (is_nil (error_fn)) error_fn= error_font (fn);
return math_font (t, fn, error_fn); return math_font (t, fn, error_fn, 1.0, 1.0);
} }
if (!font_conversion->contains (t[0]->label)) { if (!font_conversion->contains (t[0]->label)) {
font_database_load (); font_database_load ();
if (is_tuple (t) && N(t) == 6) { if (is_tuple (t) && N(t) == 6) {
string family = as_string (t[0]); string family = as_string (t[0]);
string variant= as_string (t[1]); string variant= as_string (t[1]);
string series = as_string (t[2]); string series = as_string (t[2]);
string shape = as_string (t[3]); string shape = as_string (t[3]);
array<string> a= font_database_search (family, variant, series, shape); array<string> a= font_database_search (family, variant, series, shape);
skipping to change at line 218 skipping to change at line 218
font font
find_font (tree t) { find_font (tree t) {
bench_start ("find font"); bench_start ("find font");
font fn= find_font_bis (t); font fn= find_font_bis (t);
bench_cumul ("find font"); bench_cumul ("find font");
return fn; return fn;
} }
font font
find_magnified_font (tree t, double zoom) { find_magnified_font (tree t, double zoomx, double zoomy) {
font fn= find_font (t); font fn= find_font (t);
if (is_nil (fn)) return fn; if (is_nil (fn)) return fn;
return fn->magnify (zoom); return fn->magnify (zoomx, zoomy);
} }
/****************************************************************************** /******************************************************************************
* User interface * User interface
******************************************************************************/ ******************************************************************************/
font font
find_font (string family, string variant, find_font (string family, string variant,
string series, string shape, int sz, int dpi) string series, string shape, int sz, int dpi)
{ {
string s= string s=
family * "-" * variant * "-" * family * "-" * variant * "-" *
series * "-" * shape * "-" * series * "-" * shape * "-" *
as_string (sz) * "-" * as_string (dpi); as_string (sz) * "-" * as_string (dpi);
if (font::instances->contains (s)) return font (s); if (font::instances->contains (s)) return font (s);
if (ends (shape, "-poorit")) {
string shape2= shape (0, N(shape) - 7);
font fn= find_font (family, variant, series, shape2, sz, dpi);
if (!is_nil (fn)) {
font nafn= fn->magnify (5.0/6.0, 1.0);
font itfn= poor_italic_font (nafn, 0.25001);
// NOTE: precise value 0.25001 also used in 'concat_math'
font::instances (s)= (pointer) itfn.rep;
return itfn;
}
}
else if (ends (shape, "-poorsc")) {
string shape2= shape (0, N(shape) - 7);
font fn= find_font (family, variant, series, shape2, sz, dpi);
if (!is_nil (fn)) {
font scfn= poor_smallcaps_font (fn);
font::instances (s)= (pointer) scfn.rep;
return scfn;
}
}
else if (ends (series, "-poorbf")) {
string series2= series (0, N(series) - 7);
font fn= find_font (family, variant, series2, shape, sz, dpi);
if (!is_nil (fn)) {
font bffn= poor_bold_font (fn);
font::instances (s)= (pointer) bffn.rep;
return bffn;
}
}
else if (ends (variant, "-poorbbb")) {
string variant2= variant (0, N(variant) - 8);
font fn= find_font (family, variant2, series, shape, sz, dpi);
if (!is_nil (fn)) {
font bbbfn= poor_bbb_font (fn);
font::instances (s)= (pointer) bbbfn.rep;
return bbbfn;
}
}
string family2= family; string family2= family;
if (family == "sys-chinese") family2= default_chinese_font_name (); if (family == "sys-chinese") family2= default_chinese_font_name ();
if (family == "sys-japanese") family2= default_japanese_font_name (); if (family == "sys-japanese") family2= default_japanese_font_name ();
if (family == "sys-korean") family2= default_korean_font_name (); if (family == "sys-korean") family2= default_korean_font_name ();
if (family2 != family) { if (family2 != family) {
font fn= find_font (family2, variant, series, shape, sz, dpi); font fn= find_font (family2, variant, series, shape, sz, dpi);
if (!is_nil (fn)) { if (!is_nil (fn)) {
font::instances (s)= (pointer) fn.rep; font::instances (s)= (pointer) fn.rep;
return fn; return fn;
} }
 End of changes. 5 change blocks. 
4 lines changed or deleted 43 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS