mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-22 12:42:50 +02:00
Added a crude hack to increase the robustness of font scaling. (This can
be necessary if printing unusually large components.) - postscript.c: in "maxfont", if we get a zero-sized font, dodge the division by zero git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5752 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
parent
c6312cd313
commit
2a819a82d7
@ -891,16 +891,22 @@ fprintf(file,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Stack: font string width height factor -> factor
|
* Stack: font string width height factor -> factor
|
||||||
|
*
|
||||||
|
* Hack: sometimes, scalefont can't produce a suitable font and just
|
||||||
|
* gives us something zero-sized, which trips the division. We just
|
||||||
|
* ignore this case for now. Since maxfont is used in pairs, the
|
||||||
|
* second one may still succeed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
|
"/sdiv { dup 0 eq { pop 1 } if div } def\n"
|
||||||
"/maxfont {\n"
|
"/maxfont {\n"
|
||||||
" gsave 0 0 moveto\n"
|
" gsave 0 0 moveto\n"
|
||||||
" /f exch def /h exch def /w exch def\n"
|
" /f exch def /h exch def /w exch def\n"
|
||||||
" exch f scalefont setfont\n"
|
" exch f scalefont setfont\n"
|
||||||
" false charpath flattenpath pathbbox\n"
|
" false charpath flattenpath pathbbox\n"
|
||||||
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
|
" /ury exch def /urx exch def /lly exch def /llx exch def\n"
|
||||||
" w urx llx sub div h ury lly sub div 2 copy gt { exch } if pop\n"
|
" w urx llx sub sdiv h ury lly sub sdiv 2 copy gt { exch } if pop\n"
|
||||||
" f mul grestore } def\n");
|
" f mul grestore } def\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user