"Fossies" - the Fresh Open Source Software Archive  

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

font.cpp  (TeXmacs-1.99.4-src):font.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 66 skipping to change at line 66
y2 = fn->y2; y2 = fn->y2;
yx = fn->yx; yx = fn->yx;
yfrac = fn->yfrac; yfrac = fn->yfrac;
ysub_lo_base = fn->ysub_lo_base; ysub_lo_base = fn->ysub_lo_base;
ysub_hi_lim = fn->ysub_hi_lim; ysub_hi_lim = fn->ysub_hi_lim;
ysup_lo_lim = fn->ysup_lo_lim; ysup_lo_lim = fn->ysup_lo_lim;
ysup_lo_base = fn->ysup_lo_base; ysup_lo_base = fn->ysup_lo_base;
ysup_hi_lim = fn->ysup_hi_lim; ysup_hi_lim = fn->ysup_hi_lim;
yshift = fn->yshift; yshift = fn->yshift;
wpt = fn->wpt; wpt = fn->wpt;
hpt = fn->hpt;
wfn = fn->wfn; wfn = fn->wfn;
wline = fn->wline; wline = fn->wline;
wquad = fn->wquad; wquad = fn->wquad;
} }
void void
font_rep::draw (renderer ren, string s, SI x, SI y, SI xk, bool ext) { font_rep::draw (renderer ren, string s, SI x, SI y, SI xk, bool ext) {
if (ren->zoomf == 1.0 || !ren->is_screen) { if (ren->zoomf == 1.0 || !ren->is_screen) {
if (ext) draw_fixed (ren, s, x, y, xk); if (ext) draw_fixed (ren, s, x, y, xk);
else draw_fixed (ren, s, x, y); else draw_fixed (ren, s, x, y);
skipping to change at line 92 skipping to change at line 93
else { else {
// FIXME: low level rendering hack // FIXME: low level rendering hack
SI old_ox = ren->ox; SI old_ox = ren->ox;
SI old_oy = ren->oy; SI old_oy = ren->oy;
SI old_cx1 = ren->cx1; SI old_cx1 = ren->cx1;
SI old_cy1 = ren->cy1; SI old_cy1 = ren->cy1;
SI old_cx2 = ren->cx2; SI old_cx2 = ren->cx2;
SI old_cy2 = ren->cy2; SI old_cy2 = ren->cy2;
double old_zoomf = ren->zoomf; double old_zoomf = ren->zoomf;
int old_shrinkf= ren->shrinkf; int old_shrinkf= ren->shrinkf;
SI old_pixel = ren->pixel;
SI old_thicken= ren->thicken; SI old_thicken= ren->thicken;
SI old_pixel = ren->pixel;
SI old_retina_pixel= ren->retina_pixel;
ren->ox = (SI) tm_round (old_ox * old_zoomf); ren->ox = (SI) tm_round (old_ox * old_zoomf);
ren->oy = (SI) tm_round (old_oy * old_zoomf); ren->oy = (SI) tm_round (old_oy * old_zoomf);
//ren->cx1 = (SI) ::floor (old_cx1 * old_zoomf); //ren->cx1 = (SI) ::floor (old_cx1 * old_zoomf);
//ren->cx2 = (SI) ::floor (old_cx2 * old_zoomf); //ren->cx2 = (SI) ::floor (old_cx2 * old_zoomf);
//ren->cy1 = (SI) ::ceil (old_cy1 * old_zoomf); //ren->cy1 = (SI) ::ceil (old_cy1 * old_zoomf);
//ren->cy2 = (SI) ::ceil (old_cy2 * old_zoomf); //ren->cy2 = (SI) ::ceil (old_cy2 * old_zoomf);
ren->cx1 = (SI) tm_round (old_cx1 * old_zoomf); ren->cx1 = (SI) tm_round (old_cx1 * old_zoomf);
ren->cx2 = (SI) tm_round (old_cx2 * old_zoomf); ren->cx2 = (SI) tm_round (old_cx2 * old_zoomf);
ren->cy1 = (SI) tm_round (old_cy1 * old_zoomf); ren->cy1 = (SI) tm_round (old_cy1 * old_zoomf);
ren->cy2 = (SI) tm_round (old_cy2 * old_zoomf); ren->cy2 = (SI) tm_round (old_cy2 * old_zoomf);
ren->zoomf = 1.0; ren->zoomf = 1.0;
ren->shrinkf= std_shrinkf; ren->shrinkf= std_shrinkf;
ren->brushpx= ren->pixel; ren->brushpx= ren->pixel;
ren->pixel = std_shrinkf * PIXEL;
ren->thicken= (std_shrinkf >> 1) * PIXEL; ren->thicken= (std_shrinkf >> 1) * PIXEL;
ren->pixel = std_shrinkf * PIXEL;
ren->retina_pixel= std_shrinkf * PIXEL;
SI xx= (SI) tm_round (x * old_zoomf); SI xx= (SI) tm_round (x * old_zoomf);
SI yy= (SI) tm_round (y * old_zoomf); SI yy= (SI) tm_round (y * old_zoomf);
if (ext) { if (ext) {
SI kk= (SI) tm_round (xk * old_zoomf); SI kk= (SI) tm_round (xk * old_zoomf);
zoomed_fn->draw_fixed (ren, s, xx, yy, kk); zoomed_fn->draw_fixed (ren, s, xx, yy, kk);
} }
else zoomed_fn->draw_fixed (ren, s, xx, yy); else zoomed_fn->draw_fixed (ren, s, xx, yy);
ren->ox = old_ox; ren->ox = old_ox;
ren->oy = old_oy; ren->oy = old_oy;
ren->cx1 = old_cx1; ren->cx1 = old_cx1;
ren->cx2 = old_cx2; ren->cx2 = old_cx2;
ren->cy1 = old_cy1; ren->cy1 = old_cy1;
ren->cy2 = old_cy2; ren->cy2 = old_cy2;
ren->zoomf = old_zoomf; ren->zoomf = old_zoomf;
ren->shrinkf= old_shrinkf; ren->shrinkf= old_shrinkf;
ren->brushpx= -1; ren->brushpx= -1;
ren->pixel = old_pixel;
ren->thicken= old_thicken; ren->thicken= old_thicken;
ren->pixel = old_pixel;
ren->retina_pixel= old_retina_pixel;
} }
} }
void void
font_rep::draw (renderer ren, string s, SI x, SI y) { font_rep::draw (renderer ren, string s, SI x, SI y) {
draw (ren, s, x, y, 0, false); draw (ren, s, x, y, 0, false);
} }
void void
font_rep::draw (renderer ren, string s, SI x, SI y, SI xk) { font_rep::draw (renderer ren, string s, SI x, SI y, SI xk) {
skipping to change at line 285 skipping to change at line 289
dx += ex->x2; dx += ex->x2;
} }
for (; (end<N(s)) && (s[end]==' '); end++) dx += spc->def; for (; (end<N(s)) && (s[end]==' '); end++) dx += spc->def;
start= end; start= end;
} }
} }
//bool get_glyph_fatal= true; //bool get_glyph_fatal= true;
bool get_glyph_fatal= false; bool get_glyph_fatal= false;
void
font_rep::advance_glyph (string s, int& pos) {
tm_char_forwards (s, pos);
}
glyph glyph
font_rep::get_glyph (string s) { font_rep::get_glyph (string s) {
if (get_glyph_fatal) { if (get_glyph_fatal) {
failed_error << "glyph name: " << s << "\n"; failed_error << "glyph name: " << s << "\n";
failed_error << "font : " << res_name << "\n";
FAILED ("no bitmap available"); FAILED ("no bitmap available");
} }
else cout << " no bitmap available for " << s << "\n"; else {
cout << "TeXmacs] warning, no bitmap available for " << s << "\n";
cout << "TeXmacs] in font " << res_name << "\n";
}
return glyph (0, 0, 0, 0); return glyph (0, 0, 0, 0);
} }
int
font_rep::index_glyph (string s, font_metric& fnm, font_glyphs& fng) {
(void) fnm; (void) fng;
if (get_glyph_fatal) {
failed_error << "glyph name: " << s << "\n";
failed_error << "font : " << res_name << "\n";
FAILED ("no bitmap available");
}
else {
cout << "TeXmacs] warning, no glyph index available for " << s << "\n";
cout << "TeXmacs] in font " << res_name << "\n";
}
return -1;
}
font
font_rep::poor_magnify (double zoomx, double zoomy) {
return poor_stretched_font (this, zoomx, zoomy);
}
font
font_rep::magnify (double zoom) {
return magnify (zoom, zoom);
}
/****************************************************************************** /******************************************************************************
* Error font: used to draw unindentified characters * Error font: used to draw unindentified characters
******************************************************************************/ ******************************************************************************/
struct error_font_rep: font_rep { struct error_font_rep: font_rep {
font fn; font fn;
error_font_rep (string name, font fn); error_font_rep (string name, font fn);
bool supports (string c); bool supports (string c);
void get_extents (string s, metric& ex); void get_extents (string s, metric& ex);
void get_xpositions (string s, SI* xpos); void get_xpositions (string s, SI* xpos);
void draw_fixed (renderer ren, string s, SI x, SI y); void draw_fixed (renderer ren, string s, SI x, SI y);
font magnify (double zoom); font magnify (double zoomx, double zoomy);
}; };
error_font_rep::error_font_rep (string name, font fnb): error_font_rep::error_font_rep (string name, font fnb):
font_rep (name, fnb), fn (fnb) {} font_rep (name, fnb), fn (fnb) {}
bool bool
error_font_rep::supports (string c) { error_font_rep::supports (string c) {
(void) c;
return true; return true;
} }
void void
error_font_rep::get_extents (string s, metric& ex) { error_font_rep::get_extents (string s, metric& ex) {
fn->get_extents (s, ex); fn->get_extents (s, ex);
} }
void void
error_font_rep::get_xpositions (string s, SI* xpos) { error_font_rep::get_xpositions (string s, SI* xpos) {
fn->get_xpositions (s, xpos); fn->get_xpositions (s, xpos);
} }
void void
error_font_rep::draw_fixed (renderer ren, string s, SI x, SI y) { error_font_rep::draw_fixed (renderer ren, string s, SI x, SI y) {
ren->set_pencil (red); ren->set_pencil (red);
fn->draw_fixed (ren, s, x, y); fn->draw_fixed (ren, s, x, y);
} }
font font
error_font_rep::magnify (double zoom) { error_font_rep::magnify (double zoomx, double zoomy) {
return error_font (fn->magnify (zoom)); return error_font (fn->magnify (zoomx, zoomy));
} }
font font
error_font (font fn) { error_font (font fn) {
string name= "error-" * fn->res_name; string name= "error-" * fn->res_name;
return make (font, name, tm_new<error_font_rep> (name, fn)); return make (font, name, tm_new<error_font_rep> (name, fn));
} }
/****************************************************************************** /******************************************************************************
* System dependent fonts * System dependent fonts
skipping to change at line 373 skipping to change at line 412
return font (); return font ();
} }
#endif #endif
/****************************************************************************** /******************************************************************************
* Miscellaneous * Miscellaneous
******************************************************************************/ ******************************************************************************/
static hashmap<string,font> larger_font_table; static hashmap<string,font> larger_font_table;
bool has_poor_rubber= true;
bool
use_poor_rubber (font fn) {
return has_poor_rubber && fn->type == FONT_TYPE_UNICODE &&
!starts (fn->res_name, "stix-");
}
static font static font
make_rubber_font (font fn) { make_rubber_font (font fn) {
if (starts (fn->res_name, "stix-")) if (starts (fn->res_name, "stix-"))
return rubber_stix_font (fn); return rubber_stix_font (fn);
else if (has_poor_rubber && fn->type == FONT_TYPE_UNICODE)
return poor_rubber_font (fn);
else if (fn->type == FONT_TYPE_UNICODE) else if (fn->type == FONT_TYPE_UNICODE)
return rubber_unicode_font (fn); return rubber_unicode_font (fn);
else else
return fn; return fn;
} }
font font
rubber_font (font base) { rubber_font (font base) {
if (larger_font_table->contains (base->res_name)) if (larger_font_table->contains (base->res_name))
return larger_font_table (base->res_name); return larger_font_table (base->res_name);
 End of changes. 16 change blocks. 
7 lines changed or deleted 55 lines changed or added

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