"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Graphics/Fonts/font_translate.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.

font_translate.cpp  (TeXmacs-1.99.4-src):font_translate.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 92 skipping to change at line 92
else if (v[i] == "long") r << string ("long"); else if (v[i] == "long") r << string ("long");
else if (v[i] == "flat") r << string ("flat"); else if (v[i] == "flat") r << string ("flat");
if (N(r) == 0) return "right"; if (N(r) == 0) return "right";
return recompose (r, "-"); return recompose (r, "-");
} }
/****************************************************************************** /******************************************************************************
* Upgrade old family names * Upgrade old family names
******************************************************************************/ ******************************************************************************/
static string string
upgrade_family_name (string f) { upgrade_family_name (string f) {
static hashmap<string,string> t (""); static hashmap<string,string> t ("");
if (N(t) == 0) { if (N(t) == 0) {
t ("luxi")= "Luxi"; t ("luxi")= "Luxi";
t ("ms-andalemo")= "Andale Mono"; t ("ms-andalemo")= "Andale Mono";
t ("ms-arial")= "Arial"; t ("ms-arial")= "Arial";
t ("ms-comic")= "Comic Sans MS"; t ("ms-comic")= "Comic Sans MS";
t ("ms-courier")= "Courier New"; t ("ms-courier")= "Courier New";
t ("ms-georgia")= "Georgia"; t ("ms-georgia")= "Georgia";
t ("ms-impact")= "Impact"; t ("ms-impact")= "Impact";
skipping to change at line 139 skipping to change at line 139
t ("simsun")= "SimSun"; t ("simsun")= "SimSun";
t ("simyou")= "YouYuan"; t ("simyou")= "YouYuan";
t ("ttf-japanese")= "TakaoPMincho"; t ("ttf-japanese")= "TakaoPMincho";
t ("ukai")= "AR PL ZenKai Uni"; t ("ukai")= "AR PL ZenKai Uni";
t ("uming")= "AR PL UMing CN"; t ("uming")= "AR PL UMing CN";
t ("unbatang")= "UnBatang"; t ("unbatang")= "UnBatang";
t ("wqy-microhei")= "WenQuanYi Micro Hei"; t ("wqy-microhei")= "WenQuanYi Micro Hei";
t ("wqy-zenhei")= "WenQuanYi Zen Hei"; t ("wqy-zenhei")= "WenQuanYi Zen Hei";
t ("dejavu")= "DejaVu"; t ("dejavu")= "DejaVu";
t ("stix")= "Stix"; t ("stix")= "Stix";
t ("bonum")= "TeX Gyre Bonum";
t ("chancery")= "TeX Gyre Chorus"; t ("chancery")= "TeX Gyre Chorus";
t ("pagella")= "TeX Gyre Pagella"; t ("pagella")= "TeX Gyre Pagella";
t ("schola")= "TeX Gyre Schola";
t ("termes")= "TeX Gyre Termes"; t ("termes")= "TeX Gyre Termes";
t ("adobe")= "Stix"; t ("adobe")= "Stix";
t ("Duerer")= "duerer"; t ("Duerer")= "duerer";
t ("math-asana")= "Asana Math"; t ("math-asana")= "Asana Math";
t ("math-apple")= "Apple Symbols"; t ("math-apple")= "Apple Symbols";
t ("math-bonum")= "TeX Gyre Bonum";
t ("math-dejavu")= "DejaVu"; t ("math-dejavu")= "DejaVu";
t ("math-lucida")= "Lucida Grande"; t ("math-lucida")= "Lucida Grande";
t ("math-pagella")= "TeX Gyre Pagella"; t ("math-pagella")= "TeX Gyre Pagella";
t ("math-schola")= "TeX Gyre Schola";
t ("math-stix")= "Stix"; t ("math-stix")= "Stix";
t ("math-termes")= "TeX Gyre Termes"; t ("math-termes")= "TeX Gyre Termes";
t ("modern")= "roman"; t ("modern")= "roman";
t ("cyrillic")= "roman"; t ("cyrillic")= "roman";
t ("sys-chinese")= "roman"; t ("sys-chinese")= "roman";
t ("sys-japanese")= "roman"; t ("sys-japanese")= "roman";
t ("sys-korean")= "roman"; t ("sys-korean")= "roman";
} }
if (t->contains (f)) return t[f]; if (t->contains (f)) return t[f];
skipping to change at line 255 skipping to change at line 259
} }
/****************************************************************************** /******************************************************************************
* Find closest existing font * Find closest existing font
******************************************************************************/ ******************************************************************************/
bool bool
find_closest (string& family, string& variant, string& series, string& shape, find_closest (string& family, string& variant, string& series, string& shape,
int attempt) { int attempt) {
static hashmap<tree,tree> closest_cache (UNINIT); static hashmap<tree,tree> closest_cache (UNINIT);
tree key= tuple (family, variant, series, shape, as_string (attempt)); tree val= tuple (copy (family), variant, series, shape);
tree key= tuple (copy (family), variant, series, shape, as_string (attempt));
if (closest_cache->contains (key)) { if (closest_cache->contains (key)) {
tree t = closest_cache[key]; tree t = closest_cache[key];
family = t[0]->label; family = t[0]->label;
variant= t[1]->label; variant= t[1]->label;
series = t[2]->label; series = t[2]->label;
shape = t[3]->label; shape = t[3]->label;
return t != key; return t != val;
} }
/*
else if (attempt == FONT_ATTEMPTS && family != "modern") {
family= "modern";
find_closest (family, variant, series, shape, 0);
tree t= tuple (family, variant, series, shape);
closest_cache (key)= t;
return t != val;
}
*/
else { else {
//cout << "< " << family << ", " << variant //cout << "< " << family << ", " << variant
// << ", " << series << ", " << shape << "\n"; // << ", " << series << ", " << shape << "\n";
array<string> lfn= logical_font (family, variant, series, shape); array<string> lfn= logical_font (family, variant, series, shape);
lfn= apply_substitutions (lfn); lfn= apply_substitutions (lfn);
array<string> pfn= search_font (lfn, attempt); array<string> pfn= search_font (lfn, attempt);
array<string> nfn= logical_font (pfn[0], pfn[1]); array<string> nfn= logical_font (pfn[0], pfn[1]);
array<string> gfn= guessed_features (pfn[0], pfn[1]);
//cout << lfn << " -> " << nfn << ", " << gfn << "\n";
gfn << nfn;
family= get_family (nfn); family= get_family (nfn);
variant= get_variant (nfn); variant= get_variant (nfn);
series= get_series (nfn); series= get_series (nfn);
shape= get_shape (nfn); shape= get_shape (nfn);
if ( contains (string ("outline"), lfn) &&
!contains (string ("outline"), gfn))
variant= variant * "-poorbbb";
if ( contains (string ("bold"), lfn) &&
!contains (string ("bold"), gfn))
series= series * "-poorbf";
if ( contains (string ("smallcaps"), lfn) &&
!contains (string ("smallcaps"), gfn))
shape= shape * "-poorsc";
if ((contains (string ("italic"), lfn) ||
contains (string ("oblique"), lfn)) &&
!contains (string ("italic"), gfn) &&
!contains (string ("oblique"), gfn))
shape= shape * "-poorit";
//cout << "> " << family << ", " << variant //cout << "> " << family << ", " << variant
// << ", " << series << ", " << shape << "\n"; // << ", " << series << ", " << shape << "\n";
tree t= tuple (family, variant, series, shape); tree t= tuple (family, variant, series, shape);
closest_cache (key)= t; closest_cache (key)= t;
return t != key; return t != val;
} }
} }
font font
closest_font (string family, string variant, string series, string shape, closest_font (string family, string variant, string series, string shape,
int sz, int dpi, int attempt) { int sz, int dpi, int attempt) {
string s= string s=
family * "-" * variant * "-" * family * "-" * variant * "-" *
series * "-" * shape * "-" * series * "-" * shape * "-" *
as_string (sz) * "-" * as_string (dpi) * "-" * as_string (attempt); as_string (sz) * "-" * as_string (dpi) * "-" * as_string (attempt);
 End of changes. 11 change blocks. 
4 lines changed or deleted 35 lines changed or added

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