Import of fontforge 20120731-b.

This commit is contained in:
Alexandre Julliard 2013-07-11 15:46:35 +02:00
parent 613f342ff2
commit 97204dac82
514 changed files with 258625 additions and 141837 deletions

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@

View File

@ -0,0 +1,37 @@
Name: FontForge-doc
Version: 020208
Release: 1
Summary: Docs for FontForge, a PostScript font editor
License: BSD
Group: Documentation
#Group: Applications/Publishing
Icon: pfaicon.gif
Source0: http://fontforge.sourceforge.net/fontforge_htdocs-%{version}.tgz
Url: http://fontforge.sourceforge.net/
Vendor: George Williams <gww@silcom.com>
Prefix: /usr
BuildRoot: /var/tmp/%{name}-%{version}
%description
FontForge allows you to edit outline and bitmap fonts. You can create
new ones or modify old ones. It is also a font format converter and
can convert among PostScript (ASCII & binary Type 1, some Type 3s,
some Type 0s), TrueType, OpenType (Type2) and CID-keyed fonts.
%prep
%setup -T -c -a 0 -n fontforge
%install
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}/../share/doc/fontforge
cp *.{html,png,gif,gz,tgz,txt} ${RPM_BUILD_ROOT}%{_bindir}/../share/doc/fontforge
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/../share/doc/fontforge/
%changelog
* Fri Feb 8 2002 George Williams <gww@silcom.com>
- made doc rpm

81
Packaging/FontForge.spec Normal file
View File

@ -0,0 +1,81 @@
Name: fontforge
Version: 20051201
Release: 1
Summary: An outline font editor
License: BSD
Group: Applications/Publishing
Icon: ffanvil32.gif
Source0: http://fontforge.sourceforge.net/fontforge_full-%{version}.tgz
Source1: fontforge.desktop
Url: http://fontforge.sourceforge.net/
Vendor: George Williams <gww@silcom.com>, Scott Pakin <pakin@uiuc.edu>
Prefix: /usr/local
BuildRoot: /var/tmp/%{name}-%{version}
BuildPreReq: libpng-devel, libungif-devel, libuninameslist, libxml2
%description
FontForge allows you to edit outline and bitmap fonts. You can create
new ones or modify old ones. It is also a font format converter and
can convert among PostScript (ASCII & binary Type 1, some Type 3s,
some Type 0s), TrueType, OpenType (Type2), CID-keyed, SVG, CFF and
multiple-master fonts.
%prep
%setup -T -b 0 -n fontforge
%build
%configure
#configure --with-regular-link --with-freetype-bytecode=no
make
%install
%makeinstall
%post
ldconfig
%postun
ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/fontforge
%{_libdir}/libgunicode.*
%{_libdir}/libgdraw.*
%{_libdir}/pkgconfig/fontforge.pc
%{_datadir}/fontforge
%{_mandir}/man1/fontforge.1*
%{_mandir}/man1/sfddiff.1*
%{_bindir}/../share/locale/*/LC_MESSAGES/FontForge.mo
%doc LICENSE README-Unix.html
%changelog
* Wed Nov 27 2002 Scott Pakin <pakin@uiuc.edu>
- Corrected inclusion of shared libraries and cleaned up some other things
* Fri Nov 2 2001 George Williams <gww@silcom.com>
- Went from three source packages down to just one which includes the others
* Thu May 10 2001 George Williams <gww@silcom.com>
- My first attempt at rpm, updated to 10 May sources
* Tue May 01 2001 Scott Pakin <pakin@uiuc.edu>
- Removed (unused) dynamic library files
* Sun Apr 29 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 220401 to 280401.
* Tue Apr 24 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 190401 to 220401.
* Fri Apr 20 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 020401 to 190401.
* Tue Apr 10 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 210301 to 020401.
* Thu Mar 22 2001 Scott Pakin <pakin@uiuc.edu>
- Initial release

View File

@ -0,0 +1,77 @@
Name: fontforge
Version: 030730
Release: 1
Summary: A PostScript font editor
License: BSD
Group: Applications/Publishing
Icon: pfaicon.gif
Source0: http://fontforge.sourceforge.net/fontforge_full-%{version}.tgz
Url: http://fontforge.sourceforge.net/
Vendor: George Williams <gww@silcom.com>, Scott Pakin <pakin@uiuc.edu>
Prefix: /usr
BuildRoot: /var/tmp/%{name}-%{version}
BuildPreReq: libpng-devel, libungif-devel, libxml2
#BuildPreReq: libjpeg-devel, libtiff-devel, libpng-devel, libungif-devel, freetype, libxml2
%description
FontForge allows you to edit outline and bitmap fonts. You can create
new ones or modify old ones. It is also a font format converter and
can convert among PostScript (ASCII & binary Type 1, some Type 3s,
some Type 0s), TrueType, OpenType (Type2), CID-keyed and SVG fonts.
%prep
%setup -T -b 0 -n fontforge
%build
CFLAGS="$RPM_OPT_FLAGS"
./configure
make
%install
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}/../share/fontforge
rm -rf ${RPM_BUILD_ROOT}%{_libdir}
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
%makeinstall
#%post
#ldconfig
#%postun
#ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/fontforge
%{_bindir}/../share/fontforge/
%{_mandir}/man1/fontforge.1*
%doc LICENSE README
%changelog
* Fri Nov 2 2001 George Williams <gww@silcom.com>
- went from three source packages down to just one which includes the others
* Thu May 10 2001 George Williams <gww@silcom.com>
- My first attempt at rpm, updated to 10 May sources
* Tue May 01 2001 Scott Pakin <pakin@uiuc.edu>
- Removed (unused) dynamic library files
* Sun Apr 29 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 220401 to 280401.
* Tue Apr 24 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 190401 to 220401.
* Fri Apr 20 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 020401 to 190401.
* Tue Apr 10 2001 Scott Pakin <pakin@uiuc.edu>
- Upgraded from 210301 to 020401.
* Thu Mar 22 2001 Scott Pakin <pakin@uiuc.edu>
- Initial release

View File

@ -3,14 +3,17 @@ Name=FontForge
Name[ru]=FontForge
Name[fr]=FontForge
Name[zh_TW]=
Name[uk]=FontForge
Comment=An outline font editor
Comment[ru]=Редактор шрифтов
Comment[fr]=Un constructeur des polices
Comment[zh_TW]=FontForge
Exec=fontforge
Icon=fontforge.png
Comment[pl_PL]=Edytor fontów
Comment[uk]=Редактор шрифтів
Exec=fontforge %U
Icon=fontforge
StartupWMClass=fontforge
Terminal=false
Type=Application
Categories=Application;Graphics;
Encoding=UTF-8
Categories=Graphics;
MimeType=application/vnd.font-fontforge-sfd;application/x-font-ttf;application/x-font-otf;application/x-font-type1;application/x-font-bdf;application/x-font-pcf;application/x-font-tex;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

View File

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 772 B

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="4415"
height="4481"
xml:space="preserve"
style="stroke:none">
<path
d="m 1401,3363 c 0,0 -495,186 -590,305 303,232 1332,813 1332,813 0,0 1252,-514 2018,-919 C 4081,3449 3323,3138 3323,3138 L 1401,3363"
style="fill:#332e3b" /><path
d="m 3913,3405 c -407,294 -930,599 -1766,740 C 1964,4175 1561,3716 1261,3419 1107,3484 874,3590 811,3668 1114,3901 2143,4481 2143,4481 c 0,0 1252,-514 2018,-919 -26,-37 -126,-96 -247,-157"
style="fill:#2d2833" /><path
d="m 1401,3297 c 0,0 -495,252 -590,372 303,232 1332,813 1332,813 0,0 24,-693 72,-819 -176,-133 -814,-365 -814,-365"
style="fill:#1e1b20" /><path
d="m 980,3536 c -76,49 -141,97 -169,133 303,232 1332,813 1332,813 0,0 -5,-174 8,-346 -365,-35 -941,-460 -1171,-599"
style="fill:#1a1719" /><path
d="M 1372,3350 C 1075,3054 220,2392 220,2392 L 4416,2347 c 0,0 -775,593 -1061,810 -342,228 -1146,604 -1146,604 0,0 -610,-296 -838,-410"
style="fill:#27232a" /><path
d="M 1372,3350 C 1075,3054 220,2392 220,2392 l 1908,357 c 0,0 167,129 -106,426 37,395 188,585 188,585 0,0 -610,-296 -838,-410"
style="fill:#171515" /><path
d="M 220,2392 C 562,2233 1725,1708 2364,1480 2980,1640 4074,2164 4416,2347 4029,2506 2615,3122 2022,3213 1429,3054 494,2575 220,2392"
style="fill:#332e3b" /><path
d="m 0,1369 c 328,-237 716,-453 981,-610 75,-44 121,-45 121,-45 l 181,135 -151,126 -994,627 c 0,0 -107,-153 -138,-237"
style="fill:#211d1d" /><path
d="m 1961,984 c -53,64 -327,249 -549,349 -50,-35 -81,-120 -81,-120 0,0 48,-54 21,-85 -31,-35 -89,0 -89,0 L 845,204 930,124 1053,45 1167,0 1819,755 c 0,0 -52,45 -24,87 28,43 81,11 81,11 0,0 68,72 84,132"
style="fill:#211d1d" /><path
d="m 3365.031,2210 c 0,65 -99,137 -215,137 -73,0 -156,-33 -156,-81 0,-42 67,-70 127,-70 28,0 53,5 72,14 2,1 5,2 8,2 10,0 29,-12 29,-32 0,-25 -30,-47 -53,-58 -48,-23 -103,-36 -162,-36 -105,0 -197,37 -273,73 -101,48 -185,102 -276,157 118,55 239,112 356,162 l -91,60 c -112,-60 -227,-118 -342,-175 -133,81 -274,163 -394,258 -21,16 -32,29 -32,46 0,49 184,115 239,140 l -99,52 c -362,-192 -728,-375 -1112,-545 l 96,-52 c 52,29 132,78 187,78 47,0 134,-49 192,-82 103,-59 211,-124 315,-184 -73,-33 -145,-67 -217,-99 l 88,-56 c 69,37 141,72 212,107 113,-63 233,-123 371,-159 74,-19 148,-30 237,-30 89,0 163,13 229,37 46,17 129,57 129,118 0,23 -10,37 -23,51 40,-7 86,-10 134,-10 77,0 144,9 209,24 88,20 215,74 215,153 z m -1321,-95 c 79,38 158,76 238,114 76,-42 154,-83 238,-117 -21,-11 -43,-29 -43,-54 0,-44 76,-70 127,-70 27,0 54,6 73,15 2,1 4,2 7,2 10,0 29,-13 29,-32 0,-26 -30,-45 -52,-57 -34,-16 -70,-24 -108,-24 -94,0 -178,38 -247,72 -95,47 -174,98 -262,151 z m -77,46 c -95,57 -241,145 -312,191 -50,33 -84,58 -104,78 -15,16 -23,29 -23,40 0,24 29,39 57,53 30,15 57,25 89,25 20,0 41,-4 65,-13 28,-10 61,-25 102,-48 107,-60 249,-147 364,-213 -79,-38 -159,-76 -238,-113 z"
style="fill:#f3f3f4" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="48" height="48">
<title>FontForge</title>
<defs>
<linearGradient id="gradient1">
<stop style="stop-color:#000000;stop-opacity:0.43529412" offset="0" />
<stop style="stop-color:#000000;stop-opacity:0" offset="1" />
</linearGradient>
<linearGradient id="gradient2">
<stop style="stop-color:#414549" offset="0" />
<stop style="stop-color:#35322d" offset="1" />
</linearGradient>
<linearGradient x1="15" y1="37" x2="15" y2="40" id="gradient3" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#20190e;stop-opacity:0.87450981" offset="0" />
<stop style="stop-color:#c7d2df;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient4" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#9da5ad" offset="0" />
<stop style="stop-color:#877d6f" offset="0.64" />
<stop style="stop-color:#6f6557" offset="0.67" />
<stop style="stop-color:#61594d" offset="1" />
</linearGradient>
<linearGradient x1="8" y1="2" x2="25" y2="28" id="gradient5" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ccd3da" offset="0" />
<stop style="stop-color:#c2bbb0" offset="1" />
</linearGradient>
<linearGradient x1="9" y1="2" x2="24" y2="28" id="gradient6" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.7019608" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient7" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.30980393" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="0.82" />
<stop style="stop-color:#ffffff;stop-opacity:0.05882353" offset="0.92" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="1" />
</linearGradient>
<linearGradient x1="8" y1="1" x2="24" y2="31" id="gradient8" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" />
<linearGradient x1="14" y1="4" x2="14" y2="45" id="gradient9" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" />
<linearGradient x1="24" y1="43" x2="24" y2="48" id="gradient10" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" />
<radialGradient cx="9" cy="43" r="5" fx="9" fy="43" id="gradient11" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" />
<radialGradient cx="38" cy="43" r="5" fx="38" fy="43" id="gradient12" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" />
</defs>
<path d="M 4,38 L 4,48 L 9,48 L 9,38 z" style="fill:url(#gradient11)" />
<path d="M 9,43 L 9,48 L 38,48 L 38,43 z" style="fill:url(#gradient10)" />
<path d="M 38,38 L 38,48 L 43,48 L 43,38 z" style="fill:url(#gradient12)" />
<g id="base">
<path d="M 23.5,4.5 L 23.5,37.223034 C 23,37.473034 23,39.098875 23.5,39.848875 L 23.5,43 C 23.5,44 23,44.5 22,44.5 L 9,44.5 C 8,44.5 7.5,44 7.5,43 L 7.5,39.75 C 8.9423449,39.132197 8.8284522,37.39695 7.5,37.402542 L 7.5,30 L 10.75,6 C 10.919693,4.7468799 11.5,4.5 12.5,4.5 z" style="fill:url(#gradient4);stroke:url(#gradient9);stroke-width:1;stroke-linejoin:round" />
<path d="M 8,37 C 9.25,37.25 9.5,39.25 8,40 L 23,40 C 22.5,39 22.491011,37.661796 23,37 z" style="fill:url(#gradient3)" />
<path d="M 8.5,37 L 8.5,30 L 11.75,6 C 11.817877,5.498752 12,5.5 12.5,5.5 L 22.5,5.5 L 22.5,37 M 22.5,40 L 22.5,43 C 22.5,43.5 22.5,43.5 22,43.5 L 9,43.5 C 8.5,43.5 8.5,43.5 8.5,43 L 8.5,40" style="fill:none;stroke:url(#gradient7);stroke-width:1" />
<path d="M 8.2041737,28.5 L 8,30 C 7.9812687,30.137613 8,31 9,31 L 23,31 L 23,30 L 9.75,30 C 8.75,30 8.2041737,30 8.2041737,28.5 z" style="fill:#ffffff;fill-opacity:0.37254902" />
<path d="M 8,40 L 23,40 C 23,40.5 22.75,41 22,41 L 9,41 C 8.25,41 8,40.5 8,40 z" style="fill:#ffffff;fill-opacity:0.43529412" />
</g>
<use xlink:href="#base" transform="matrix(-1,0,0,1,47,0)" x="0" y="0" width="48" height="48" />
<path id="ink" d="M 8,30 C 7.875,30 7.875,30.5 7.875,31 L 7.875,35.5 C 7.875,36 7.875,36.5 8,36.5 C 8.8730023,36.712517 8.0245199,35.084286 8.8210136,34.954575 C 9.1878495,34.894835 8.5863387,34.070374 8.78125,33.9375 C 8.9374845,33.830993 9.2378951,34.440745 9.28125,33.90625 C 9.330335,33.301111 9.6596505,32.706452 9.9453125,33.15625 C 10.266843,33.662525 10.19629,33.14236 10.515625,33.1875 C 10.72905,33.217669 10.268947,33.820493 10.804687,33.65625 C 11.504143,33.441817 10.437491,32.518798 10.585938,32.078125 C 10.881608,31.200414 11.81431,32.825454 11.982258,32.170947 C 12.043924,31.930629 12.338022,31.864598 12.534034,32.329417 C 12.659449,32.626822 12.08459,33.127279 12.6875,32.9375 C 13.068205,32.817665 12.83336,33.634179 13.125,33.46875 C 13.574715,33.213656 12.562901,32.52067 12.941291,32.457701 C 13.694431,32.33237 13.504458,33.363951 14.040403,33.363951 C 14.351242,33.363951 14.099255,32.73516 14.489276,32.73516 C 15.166175,32.73516 14.599268,33.5 15,33.5 C 15.322055,33.5 15.764909,32.281087 15.904354,32.709922 C 16.141525,33.439295 16.481433,33.649853 16.445083,32.906575 C 16.42394,32.474258 17.098285,32.659122 16.9375,32.5 C 16.673603,32.238833 16.922761,31.829797 17.367187,32.320312 C 17.766328,32.760846 18.228584,30.868403 18.43796,32.728134 C 18.588447,34.064805 18.937608,32.03718 19.651119,33.447113 C 20.291168,34.711882 20.526844,31.076083 20.912952,32.230679 C 21.25599,33.256479 22.488311,30.977103 22.101562,32.257812 C 21.898542,32.930107 22.718339,32.671817 22.507812,33.117187 C 22.160021,33.85294 22.895248,33.786282 23,35 C 23.125,35 23.125,34.5 23.125,34 L 23.125,31 C 23.125,30.5 23.125,30 23,30 C 23,30.5 22.734375,30.984375 22,31 L 9,31 C 8.234375,30.984375 8,30.5 8,30 z M 9.4428616,32.129576 C 9.8948348,32.029632 9.6272032,32.444425 9.6452014,32.512944 C 9.7991778,33.099131 8.8785438,32.254363 9.4428616,32.129576 z" style="fill:#2f2e30" />
<use xlink:href="#ink" transform="translate(16,0)" x="0" y="0" width="48" height="48" />
<path d="M 9,15 C 9,16.5 9.43934,16.646447 10.5,17 C 15,18.5 13.5,31.5 25,31.5 C 31,31.5 33,30.5 31,28 L 24,28 C 19.309359,13.328854 21.5,17.5 21.5,15 z" style="fill:#161108;fill-opacity:0.2" />
<path d="M 17,5 C 17.5,9.5 21.5,6 23.5,13 C 24.186803,15.40381 23.487539,16.552786 25.5,17 C 30,18 29,33 40,31 C 34,13 36.5,17.5 36.5,15 z" style="fill:#161108;fill-opacity:0.2" />
<g id="f">
<path d="M 7,1 C 3.75,1 2,2.25 2,4 L 2,5 C 2,6 2.75,7 4,7 C 6.75,7 8.5,10 8.5,12 L 8.5,14.75 C 8.5,16.5 11.090311,13.548431 13,18.75 C 15.383516,25.242169 20,31 25,31 C 29,31 31,30 31,28 L 31,26 C 31,24.75 30,24 28.5,24 C 26.5,24 26.25,26 25,26 C 23.75,26 21.37435,19.234835 20.75,17.25 C 19.942051,14.681495 21.5,16 21.5,15 L 21.5,10.75 C 21.5,10.25 21.5,10.25 17.5,10 C 14.75,4 11.25,1 7,1 z" style="fill:url(#gradient8)" />
<path d="M 7,2 C 4,2 3,3 3,4 C 3,4.5 3.5,5 4.5,5 C 6.5,5 5.5,3 8,3 C 9.5,3 10.5,5.25 12.78125,10.84375 L 9,11 L 9,12 L 13.338339,12.190053 L 15.5,17.5 C 17.75,23 20.75,28 26,28 C 29,28 30,27 30,26 C 30,25.5 29.5,25 28.5,25 C 26.5,25 27.5,27 25,27 C 23.5,27 22.454854,24.519006 21,21 L 17.34375,12.15625 L 21,12 L 21,11 L 16.78125,10.8125 C 15.120675,7.1376742 12.25,2 7,2 z M 8,6 C 6.875,6 6.4375,6.25 6,6.5 C 7.5059731,7.2359764 8.6301717,8.6917492 9.15625,10.1875 C 9.4524943,10.132785 10.046891,10.132909 10.70339,10.050847 C 10.20339,8.0508475 9.25,6 8,6 z M 9.6016953,13.847458 L 9.6016953,14.398305 C 11.101695,14.398305 12.008475,14.79661 12.762712,16.110169 L 12.008475,14.08244 z M 19,14 L 19.838474,16.257712 C 19.338474,14.437485 20.107864,14.643818 20.5,14.5 L 20.5,13.784273 z" style="fill:url(#gradient5)" />
<path d="M 6.9914976,2.3794417 C 4.0383726,2.3794417 3.3740801,3.37454 3.3740801,3.8884041 C 3.3740801,4.3884041 3.7424175,4.6259199 4.5705425,4.6259199 C 6.1174175,4.6259199 5.3750569,2.65625 7.984375,2.65625 C 9.984436,2.65625 11.099774,5.8330267 13.334149,11.192402 L 9.3774508,11.360371 L 9.379566,11.641689 L 13.593241,11.820542 L 15.953125,17.625 C 18.203125,23.125 21.25,27.640625 25.9375,27.640625 C 28.9375,27.640625 29.625,26.71875 29.625,26 C 29.625,25.5 28.921875,25.375 28.484375,25.375 C 26.8125,25.375 27.703125,27.359375 25,27.359375 C 23.15625,27.359375 22.147923,24.704198 20.6875,21.1875 L 16.78125,11.78125 L 20.623374,11.640663 L 20.621093,11.359375 L 16.534391,11.18658 C 13.830081,4.8519825 10.556757,2.3794417 6.9914976,2.3794417 z" style="fill:none;stroke:url(#gradient6);stroke-width:0.75" />
</g>
<use xlink:href="#f" transform="translate(15,0)" x="0" y="0" width="48" height="48" />
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="16" height="16" id="svg2">
<defs id="defs6">
<linearGradient id="gradient1">
<stop style="stop-color:#000000;stop-opacity:0.43529412" offset="0" />
<stop style="stop-color:#000000;stop-opacity:0" offset="1" />
</linearGradient>
<linearGradient id="gradient2">
<stop style="stop-color:#414549" offset="0" />
<stop style="stop-color:#35322d" offset="1" />
</linearGradient>
<linearGradient x1="15" y1="37" x2="15" y2="40" id="gradient3" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#20190e;stop-opacity:0.87450981" offset="0" />
<stop style="stop-color:#c7d2df;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient4" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#9da5ad" offset="0" />
<stop style="stop-color:#877d6f" offset="0.64" />
<stop style="stop-color:#6f6557" offset="0.67" />
<stop style="stop-color:#61594d" offset="1" />
</linearGradient>
<linearGradient x1="8" y1="2" x2="25" y2="28" id="gradient5" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ccd3da" offset="0" />
<stop style="stop-color:#c2bbb0" offset="1" />
</linearGradient>
<linearGradient x1="9" y1="2" x2="24" y2="28" id="gradient6" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.7019608" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient7" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.30980393" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="0.82" />
<stop style="stop-color:#ffffff;stop-opacity:0.05882353" offset="0.92" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="1" />
</linearGradient>
<linearGradient x1="24" y1="43" x2="24" y2="48" id="gradient10" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.32509954,0,0,0.39963679,-0.14615713,-3.1846287)" />
<radialGradient cx="8" cy="43" r="5" fx="8" fy="43" id="gradient11" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.38697135,0,0,0.39963679,-0.64113163,-3.1846287)" />
<radialGradient cx="39" cy="43" r="5" fx="39" fy="43" id="gradient12" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.39139079,0,0,0.39963679,-2.7315158,-3.1846287)" />
<linearGradient x1="3" y1="1" x2="9" y2="11" id="linearGradient3083" xlink:href="#gradient5" gradientUnits="userSpaceOnUse" gradientTransform="translate(-1,0)" />
<linearGradient x1="3" y1="1" x2="9" y2="11" id="linearGradient3118" xlink:href="#gradient5" gradientUnits="userSpaceOnUse" gradientTransform="translate(4,0)" />
<linearGradient x1="2" y1="0" x2="9" y2="12" id="linearGradient3071" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" gradientTransform="translate(-1,0)" />
<linearGradient x1="16" y1="14.289419" x2="16" y2="44" id="linearGradient3074" xlink:href="#gradient4" gradientUnits="userSpaceOnUse" />
<linearGradient x1="14" y1="10.909895" x2="14" y2="45" id="linearGradient3076" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" />
<linearGradient x1="16" y1="5" x2="16" y2="44" id="linearGradient3078" xlink:href="#gradient7" gradientUnits="userSpaceOnUse" />
</defs>
<path d="M 0.5197816,12.00157 L 0.5197816,15.997937 L 2.4546395,15.997937 L 2.4546395,12.00157 z" id="path56" style="fill:url(#gradient11)" />
<path d="M 2.4546395,13.999753 L 2.4546395,15.997937 L 12.532725,15.997937 L 12.532725,13.999753 z" id="path58" style="fill:url(#gradient10)" />
<path d="M 12.532725,12.00157 L 12.532725,15.997937 L 14.489679,15.997937 L 14.489679,12.00157 z" id="path60" style="fill:url(#gradient12)" />
<g transform="matrix(0.37091057,0,0,0.37091057,-1.2788983,-2.0128474)" id="base">
<path d="M 23.668504,12.166942 L 23.678726,43 C 23.678726,44 23.178726,44.5 22.178726,44.5 L 11.696068,44.5 C 10.696068,44.5 10.169284,43.999641 10.196068,43 L 10.247741,41.071405 C 11.986042,39.844803 11.497741,37.753905 10.247741,37.027303 L 10.196068,32.696068 L 11.592521,13.666942 C 11.685072,12.405776 12.342521,12.166942 13.342521,12.166942 z" id="path63" style="fill:url(#linearGradient3074);stroke:url(#linearGradient3076);stroke-width:2.69606757;stroke-linejoin:round;stroke-opacity:1" />
<path d="M 12.526782,37.779585 L 12.526782,40.475653 L 22.32047,40.475653 L 22.32047,37.779585 z" id="path65" style="fill:#000000;fill-opacity:0.24705882" />
<path d="M 22.32047,41.823687 L 11.536199,41.823687 M 12.884234,37.779585 L 12.983325,32.50216 L 14.081902,15.36148 C 14.114255,14.856692 14.331926,14.856637 14.831902,14.86148 L 20.981708,14.921055 L 20.972436,37.779585" id="path67" style="fill:none;stroke:url(#linearGradient3078);stroke-width:2.69606757;stroke-opacity:1" />
<path d="M 14.232267,35.083517 L 22.32047,35.083517 L 22.32047,32.38745 L 12.884233,32.38745 z" id="path69" style="fill:#ffffff;fill-opacity:0.37254902" />
</g>
<use transform="matrix(-1,0,0,1,15,4.2376936e-8)" id="use73" x="0" y="0" width="48" height="48" xlink:href="#base" />
<use transform="translate(5,0)" id="use3059" x="0" y="0" width="16" height="16" xlink:href="#path4068" />
<path d="M 2,0 C -0.95933688,0 -0.12460588,3.0000001 1.0138651,3.0000001 C 1.886771,3.0000001 1.1150411,5.9558057 1.881282,5.9558057 C 3.693141,5.9558057 3.23456,12.65625 8,12 C 8.8255429,11.886314 10.000001,11.797372 10.000001,10.5 C 10.000001,9.2860603 9.229849,8.3191876 8.301127,8.8475413 C 7.3392348,9.3947658 7.323294,8.2832303 6.490847,6.0388324 C 7.532191,5.7165067 7.5,6.0026019 7.5,4.5 C 7.5,4.0944031 7.496717,3.2479961 5.391736,3.1276811 C 5.005833,1.523694 3.660606,0 2,0 z" id="path4068" style="fill:url(#linearGradient3071);fill-opacity:1;stroke:none" />
<path d="M 4.7501446,4.1182397 C 3.9970039,2.3184139 3.5956797,0.94841785 1.989579,0.848981 C 0.1873981,0.73740443 0.8408668,2.480187 1.5293313,2.1223792 C 2.0704897,1.8411292 2.3885843,0.81444409 3.4200687,4.054629 L 2.002523,4.1220311 L 2.024621,4.895889 L 3.7698303,4.833714 C 4.9652066,9.0262149 6.209356,11.002267 8.10584,11.002267 C 8.859184,11.002267 9.337465,11.087901 9.296207,10.082911 C 9.247178,8.8886429 8.5971931,9.9903281 7.8596318,10.029535 C 7.2518683,10.061843 5.812872,6.7271261 5.1865342,4.9929698 L 6.477049,4.892748 L 6.489993,4.130073 z" id="path4070" style="fill:url(#linearGradient3083);fill-opacity:1;stroke:none" />
<path d="M 4.7501446,4.1182397 C 3.9970039,2.3184139 3.5956796,0.94841791 1.989579,0.848981 C 0.187398,0.73740436 0.8408668,2.480187 1.5293313,2.1223792 C 2.0704897,1.8411292 2.3885843,0.81444409 3.4200687,4.054629 L 2.002523,4.1220311 L 2.024621,4.895889 L 3.7698303,4.833714 C 4.9652066,9.0262149 6.209356,11.002267 8.10584,11.002267 C 8.859184,11.002267 9.337465,11.087901 9.296207,10.082911 C 9.247178,8.8886429 8.5971931,9.9903281 7.8596318,10.029535 C 7.2518683,10.061843 5.812872,6.7271261 5.1865342,4.9929698 L 6.477049,4.892748 L 6.489993,4.130073 z" id="path3746" style="fill:#ffffff;fill-opacity:0.6667;stroke:none" />
<path d="M 9.750145,4.1182397 C 8.9970037,2.3184139 8.5956796,0.93736932 6.989579,0.848981 C 5.1866755,0.74976204 5.8408668,2.480187 6.5293313,2.1223792 C 7.0704897,1.8411292 7.3885843,0.81444409 8.4200687,4.054629 L 7.002523,4.1220311 L 7.024621,4.895889 L 8.7698303,4.833714 C 9.965206,9.0262149 11.209356,11.002267 13.10584,11.002267 C 13.859184,11.002267 14.337465,11.087901 14.296207,10.082911 C 14.247178,8.8886429 13.597193,9.9903281 12.859632,10.029535 C 12.251868,10.061843 10.812872,6.7271261 10.186534,4.9929698 L 11.977049,4.892748 L 11.989993,4.130073 z" id="path3069" style="fill:url(#linearGradient3118);fill-opacity:1;stroke:none" />
<path d="M 9.750145,4.1182397 C 8.9970037,2.3184139 8.5956796,0.93736932 6.989579,0.848981 C 5.1866754,0.74976204 5.8408668,2.480187 6.5293313,2.1223792 C 7.0704897,1.8411292 7.3885843,0.81444409 8.4200687,4.054629 L 7.002523,4.1220311 L 7.024621,4.895889 L 8.7698303,4.833714 C 9.965206,9.0262149 11.209356,11.002267 13.10584,11.002267 C 13.859184,11.002267 14.337465,11.087901 14.296207,10.082911 C 14.247178,8.8886429 13.597193,9.9903281 12.859632,10.029535 C 12.251868,10.061843 10.812872,6.7271261 10.186534,4.9929698 L 11.977049,4.892748 L 11.989993,4.130073 z" id="path3071" style="fill:#ffffff;fill-opacity:0.6667;stroke:none" />
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24">
<defs id="defs6">
<linearGradient id="gradient1">
<stop style="stop-color:#000000;stop-opacity:0.43529412" offset="0" />
<stop style="stop-color:#000000;stop-opacity:0" offset="1" />
</linearGradient>
<linearGradient id="gradient2">
<stop style="stop-color:#414549" offset="0" />
<stop style="stop-color:#35322d" offset="1" />
</linearGradient>
<linearGradient x1="15" y1="37" x2="15" y2="40" id="gradient3" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#20190e;stop-opacity:0.87450981" offset="0" />
<stop style="stop-color:#c7d2df;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient4" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#9da5ad" offset="0" />
<stop style="stop-color:#877d6f" offset="0.64" />
<stop style="stop-color:#6f6557" offset="0.67" />
<stop style="stop-color:#61594d" offset="1" />
</linearGradient>
<linearGradient x1="8" y1="2" x2="25" y2="28" id="gradient5" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ccd3da" offset="0" />
<stop style="stop-color:#c2bbb0" offset="1" />
</linearGradient>
<linearGradient x1="9" y1="2" x2="24" y2="28" id="gradient6" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.7019608" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient7" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.30980393" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="0.82" />
<stop style="stop-color:#ffffff;stop-opacity:0.05882353" offset="0.92" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="1" />
</linearGradient>
<linearGradient x1="24" y1="43" x2="24" y2="48" id="gradient10" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.42080861,0,0,0.60000001,1.6313949,-4.8)" />
<radialGradient cx="8" cy="43" r="5" fx="8" fy="43" id="gradient11" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.59841394,0,0,0.60000001,0.21055233,-4.8)" />
<radialGradient cx="39" cy="43" r="5" fx="39" fy="43" id="gradient12" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.59286377,0,0,0.60000001,-5.0787564,-4.8)" />
<linearGradient x1="2" y1="1" x2="11" y2="15" id="linearGradient3083" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" />
<linearGradient x1="3" y1="2" x2="11" y2="14" id="linearGradient3085" xlink:href="#gradient5" gradientUnits="userSpaceOnUse" />
<linearGradient x1="16" y1="5" x2="16" y2="44" id="linearGradient3089" xlink:href="#gradient4" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.5,0,0,0.45288712,-1.2157275,0.47714674)" />
<linearGradient x1="14" y1="4" x2="14" y2="45" id="linearGradient3091" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.5,0,0,0.45288712,-1.2157275,0.47714674)" />
<linearGradient x1="16" y1="5" x2="16" y2="44" id="linearGradient3093" xlink:href="#gradient7" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.5,0,0,0.45288712,-1.2157275,0.47714674)" />
</defs>
<path d="M 2.0057941,18 L 2.0057941,24 L 4.9978637,24 L 4.9978637,18 z" id="path56" style="fill:url(#gradient11)" />
<path d="M 4.9978637,21 L 4.9978637,24 L 18.042931,24 L 18.042931,21 z" id="path58" style="fill:url(#gradient10)" />
<path d="M 18.042931,18 L 18.042931,24 L 21.00725,24 L 21.00725,18 z" id="path60" style="fill:url(#gradient12)" />
<use transform="matrix(-1,0,0,1,23,0)" id="use3240" x="0" y="0" width="22" height="22" xlink:href="#g3233" />
<use transform="translate(6.9998947,0)" id="use4429" x="0" y="0" width="22" height="22" xlink:href="#path4427" />
<g transform="matrix(1,0,0,0.99300137,0.9657275,1.013622)" id="g3233">
<path d="M 10.534272,2.5151387 L 10.534272,17.347191 C 10.208002,17.486017 10.169866,18.344567 10.534272,19.029872 L 10.534272,19.951293 C 10.534272,20.40418 10.284273,20.630624 9.7842726,20.630624 L 4.2842725,20.630624 C 3.7842726,20.630624 3.5409842,20.40413 3.5342725,19.951293 L 3.5215606,19.093626 C 4.4669295,18.759803 4.302433,17.366332 3.5342725,17.146226 L 3.5342725,14.06376 L 5.4469092,3.1944693 C 5.5463505,2.6293558 5.8219092,2.5151387 6.3219092,2.5151387 z" id="path63" style="fill:url(#linearGradient3089);stroke:url(#linearGradient3091);stroke-width:1.00351775;stroke-linejoin:round;stroke-opacity:1" />
<path d="M 4.0342725,17.106097 C 4.4979927,17.44178 4.6601135,17.768141 4.6601135,18.095041 L 9.7825909,18.113145 C 9.7825909,17.456815 9.9224614,17.357342 10.034273,17.105955 z" id="path65" style="fill:#000000;fill-opacity:0.18431373" />
<path d="M 4.5342725,17.106097 L 4.5427471,14.012913 L 5.781574,7.0360066 M 9.5098471,7.030678 L 9.5342725,17.106097 M 9.0342725,19.623717 L 10.034273,19.623717 M 5.0342725,19.623717 L 4.0342725,19.623717" id="path67" style="fill:none;stroke:url(#linearGradient3093);stroke-width:1.00351775;stroke-opacity:1" />
<path d="M 4.1421362,13.436597 C 3.9944191,13.950882 4.0519386,14.353021 4.0342725,15.092001 L 10.030035,15.051039 L 10.030035,14.116665 L 5.1931708,14.116665 C 4.6931708,14.116665 4.3073905,14.108477 4.1421362,13.436597 z" id="path69" style="fill:#ffffff;fill-opacity:0.37254902" />
<path d="M 4.0342725,19.120193 C 4.5069813,18.884082 4.6668206,18.576213 4.6601135,18.131249 L 9.7825909,18.113145 C 9.7825909,18.488668 9.9224614,18.868948 10.034273,19.120335 z" id="path3229" style="fill:#ffffff;fill-opacity:0.18431373" />
</g>
<path d="M 4.9811401,16 L 4.9811401,18 C 5.384106,16.594038 6.7008143,16 7.99057,16 C 9.2803257,16 10.590516,16.543076 11,17.40625 L 11,16 z" id="path4427" style="fill:#2f2e30;fill-opacity:0.49803922;stroke:none" />
<use transform="translate(7,0)" id="use3106" x="0" y="0" width="22" height="22" xlink:href="#g4431" />
<g transform="translate(1,1)" id="g4431">
<path d="M 3.0033642,1.0213415 C 1.2165685,1.0213415 0.03595458,1.5025232 0.03595458,2.6831371 C 0.03595458,4.2476765 0.51085065,4.7763877 1.4853869,4.7763877 C 2.3760114,4.7763877 2.9590223,5.0181605 2.9781596,6.0179773 L 3.0290071,8.6744755 C 3.0457522,9.5493151 4.3467609,8.0474543 5.5616581,10.854248 C 7.3048263,14.881514 8.3993029,15.529039 11.38469,15.58297 C 13.422578,15.619784 14.02206,14.03937 14.02206,13.135593 C 14.02206,12.228283 13.904718,11.191332 12.63983,11.191332 C 11.436441,11.191332 11.794492,11.957627 11.09322,11.957627 C 10.46822,11.957627 9.9922598,10.558096 9.6800848,9.565678 C 9.2761108,8.2814255 10.071627,9.0359546 10.071909,8.5359546 L 10.073591,5.5547729 C 10.073732,5.304773 9.75,5.125 7.75,5 C 6.375,2 4.4272498,1.0213415 3.0033642,1.0213415 z" id="path83" style="fill:url(#linearGradient3083);fill-opacity:1" />
<path d="M 3,2 C 1.5179773,2 0.94606812,2.2709998 0.94606812,2.96875 C 0.94606812,3.21875 0.93749999,4 1.4375,4 C 2.4375,4 1.6061816,2.96875 3,2.96875 C 3.75,2.96875 4.6166027,3.1804431 5.34375,6.03125 L 3.53125,6.03125 L 3.5,7 L 5.75,6.9375 C 7.0096436,9.8473155 8.0603654,14.121303 11.375,14.03125 C 12.9643,13.988071 13.09375,13.676032 13.09375,13.122101 C 13.09375,12.638396 13.09375,12.364374 12.59375,12.364374 C 10.847618,12.364374 12.28125,13.076614 11.03125,13.076614 C 9.6289602,13.076614 8.8131519,9.8184881 7.71875,7.0625 L 9.46875,7 L 9.46875,6.0625 L 7.28125,6.03125 C 6.450962,4.1938371 5.1396131,2 3,2 z M 3.0419996,4.4764771 L 3.5625,5.34375 L 4.13011,5.2867956 C 3.9360724,4.346887 3.6861747,3.8957157 3.0419996,4.4764771 z" id="path85" style="fill:url(#linearGradient3085);fill-opacity:1" />
<path d="M 3,2 C 1.5179773,2 0.94606812,2.2709998 0.94606812,2.96875 C 0.94606812,3.21875 0.93749999,4 1.4375,4 C 2.4375,4 1.6061816,2.96875 3,2.96875 C 3.75,2.96875 4.6166027,3.1804431 5.34375,6.03125 L 3.53125,6.03125 L 3.5,7 L 5.75,6.9375 C 7.0096436,9.8473155 8.0603654,14.121303 11.375,14.03125 C 12.9643,13.988071 13.09375,13.676032 13.09375,13.122101 C 13.09375,12.638396 13.09375,12.364374 12.59375,12.364374 C 10.847618,12.364374 12.28125,13.076614 11.03125,13.076614 C 9.6289602,13.076614 8.8131519,9.8184881 7.71875,7.0625 L 9.46875,7 L 9.46875,6.0625 L 7.28125,6.03125 C 6.450962,4.1938371 5.1396131,2 3,2 z M 3.0419996,4.4764771 L 3.5625,5.34375 L 4.13011,5.2867956 C 3.9360724,4.346887 3.6861747,3.8957157 3.0419996,4.4764771 z" id="path3216" style="fill:#ffffff;fill-opacity:0.49803922;stroke:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="32" height="32" id="svg2">
<defs id="defs6">
<linearGradient id="gradient1">
<stop style="stop-color:#000000;stop-opacity:0.43529412" offset="0" />
<stop style="stop-color:#000000;stop-opacity:0" offset="1" />
</linearGradient>
<linearGradient id="gradient2">
<stop style="stop-color:#414549" offset="0" />
<stop style="stop-color:#35322d" offset="1" />
</linearGradient>
<linearGradient x1="15" y1="37" x2="15" y2="40" id="gradient3" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#20190e;stop-opacity:0.87450981" offset="0" />
<stop style="stop-color:#c7d2df;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient4" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#9da5ad" offset="0" />
<stop style="stop-color:#877d6f" offset="0.64" />
<stop style="stop-color:#6f6557" offset="0.67" />
<stop style="stop-color:#61594d" offset="1" />
</linearGradient>
<linearGradient x1="8" y1="2" x2="25" y2="28" id="gradient5" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ccd3da" offset="0" />
<stop style="stop-color:#c2bbb0" offset="1" />
</linearGradient>
<linearGradient x1="9" y1="2" x2="24" y2="28" id="gradient6" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.7019608" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.49803922" offset="1" />
</linearGradient>
<linearGradient x1="16" y1="5" x2="16" y2="44" id="gradient7" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ffffff;stop-opacity:0.30980393" offset="0" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="0.82" />
<stop style="stop-color:#ffffff;stop-opacity:0.05882353" offset="0.92" />
<stop style="stop-color:#ffffff;stop-opacity:0.18431373" offset="1" />
</linearGradient>
<linearGradient x1="24" y1="43" x2="24" y2="48" id="gradient10" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68687506,0,0,0.6503772,-0.63004368,0.58722851)" />
<radialGradient cx="8" cy="43" r="5" fx="8" fy="43" id="gradient11" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68687506,0,0,0.6503772,-0.63004368,0.58722851)" />
<radialGradient cx="39" cy="43" r="5" fx="39" fy="43" id="gradient12" xlink:href="#gradient1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68687506,0,0,0.6503772,-0.63004368,0.58722851)" />
<linearGradient x1="16" y1="5" x2="16" y2="44" id="linearGradient3452" xlink:href="#gradient4" gradientUnits="userSpaceOnUse" />
<linearGradient x1="14" y1="4" x2="14" y2="45" id="linearGradient3454" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" />
<linearGradient x1="16" y1="5" x2="16" y2="44" id="linearGradient3458" xlink:href="#gradient7" gradientUnits="userSpaceOnUse" />
<linearGradient x1="15.475949" y1="36.767544" x2="15.475949" y2="39.842682" id="linearGradient3604" xlink:href="#gradient3" gradientUnits="userSpaceOnUse" />
<linearGradient x1="9" y1="2" x2="24" y2="28" id="linearGradient3655" xlink:href="#gradient6" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68935469,0,0,0.66748663,-0.32364255,0.71817086)" />
<linearGradient x1="8" y1="1" x2="24" y2="31" id="linearGradient3661" xlink:href="#gradient2" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68935469,0,0,0.66748663,-0.38332076,0.31967682)" />
<linearGradient x1="8" y1="2" x2="25" y2="28" id="linearGradient3063" xlink:href="#gradient5" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.68935469,0,0,0.66748663,-0.38332076,0.31967682)" />
</defs>
<path d="M 1.4305812,25.301563 L 1.4305812,31.805334 L 4.8649567,31.805334 L 4.8649567,25.301563 z" id="path56" style="fill:url(#gradient11)" />
<path d="M 4.8649567,28.553448 L 4.8649567,31.805334 L 26.158083,31.805334 L 26.158083,28.553448 z" id="path58" style="fill:url(#gradient10)" />
<path d="M 26.158083,25.301563 L 26.158083,31.805334 L 29.592459,31.805334 L 29.592459,25.301563 z" id="path60" style="fill:url(#gradient12)" />
<g transform="matrix(0.68687506,0,0,0.6503772,-0.63004368,0.58722851)" id="base">
<path d="M 23.5,4.5 L 23.5,36.429094 C 23,36.679094 23,39.390907 23.5,40.140907 L 23.5,43 C 23.5,44 23,44.5 22,44.5 L 9,44.5 C 8,44.5 7.5,44 7.5,43 L 7.5,40.140907 C 9,39.390907 8.75,36.679094 7.5,36.429094 L 7.5,30 L 10.75,6 C 10.919693,4.7468799 11.5,4.5 12.5,4.5 z" id="path63" style="fill:url(#linearGradient3452);stroke:url(#linearGradient3454);stroke-width:1.4961617;stroke-linejoin:round;stroke-opacity:1" />
<path d="M 8.2590953,36.022731 C 9.4350681,36.507275 9.7220817,39.523635 8.2590953,40.54727 L 22.777918,40.54727 C 22.277918,39.54727 22.203891,37.109092 22.777918,36.022731 z" id="path65" style="fill:url(#linearGradient3604)" />
<path d="M 8.9711064,35.961285 L 8.9711064,30.054452 L 12.116416,6.5445224 C 12.183492,6.0431577 12.366416,6.0445224 12.866416,6.0445224 L 21.976548,6.0445224 L 21.976548,35.94455 M 22.028894,40.586361 L 22.028894,42.457138 C 22.028894,42.957138 22.028894,42.957138 21.528894,42.957138 L 9.4711064,42.957138 C 8.9711064,42.957138 8.9711064,42.957138 8.9711064,42.457138 L 8.9711064,40.586361" id="path67" style="fill:none;stroke:url(#linearGradient3458);stroke-width:1.4961617;stroke-opacity:1" />
<path d="M 8.4262554,28.421819 L 8.2220817,30.390907 C 8.2077517,30.529109 8.2220817,31.390907 9.2220817,31.390907 L 22.740905,31.390907 L 22.740905,29.921819 L 9.9720817,29.921819 C 8.9720817,29.921819 8.4262554,29.921819 8.4262554,28.421819 z" id="path69" style="fill:#ffffff;fill-opacity:0.37254902" />
</g>
<use transform="matrix(-1,0,0,1,31.023041,3.7987314e-8)" id="use73" x="0" y="0" width="48" height="48" xlink:href="#base" />
<path d="M 5.0174991,20.352781 L 5.0174991,23.94464 C 5.5993866,24.082857 5.0338423,23.659485 5.5647341,23.575124 C 5.8092436,23.53627 5.4083149,23.00006 5.5382302,22.913642 C 5.6423662,22.844372 5.8426007,23.240941 5.8714983,22.893318 C 5.9042153,22.499749 6.1237158,22.112997 6.3141201,22.405535 C 6.5284316,22.734804 6.4814056,22.396501 6.6942538,22.42586 C 6.8365094,22.445481 6.5298339,22.837543 6.8869242,22.730725 C 7.3531367,22.591261 6.6421747,21.99095 6.7411198,21.704346 C 6.9381946,21.133504 7.5598743,22.190392 7.6718176,21.764716 C 7.7129203,21.608419 7.9089473,21.565473 8.0395962,21.867781 C 8.1231898,22.061207 7.7400256,22.386693 8.1418868,22.263264 C 8.3956405,22.185326 8.2391078,22.716368 8.4334964,22.608777 C 8.7332476,22.442869 8.0588371,21.992168 8.3110477,21.951214 C 8.8130425,21.869701 8.686419,22.540618 9.0436458,22.540618 C 9.2508325,22.540618 9.0828731,22.131666 9.3428379,22.131666 C 9.7940145,22.131666 9.4161512,22.629101 9.683252,22.629101 C 9.897914,22.629101 10.193092,21.836348 10.286037,22.115253 C 10.444118,22.589621 10.670679,22.726562 10.646452,22.243151 C 10.63236,21.961981 11.081835,22.082213 10.974665,21.978724 C 10.79877,21.808866 10.964841,21.542839 11.261066,21.86186 C 11.527109,22.148373 11.835218,20.917571 11.974776,22.127097 C 12.075082,22.996439 12.30781,21.677716 12.78339,22.594705 C 13.210006,23.417282 13.367092,21.052642 13.624447,21.803565 C 13.853095,22.470721 14.674483,20.988267 14.416699,21.821211 C 14.281379,22.258457 14.827805,22.090469 14.687479,22.380129 C 14.455664,22.858646 14.945719,22.815293 15.015541,23.604668 L 15.015541,20.352781 C 15.015541,20.67797 14.838491,20.992997 14.349003,21.003159 L 5.6840352,21.003159 C 5.1737184,20.992997 5.0174991,20.67797 5.0174991,20.352781 z M 5.9792184,21.737809 C 6.2804749,21.672807 6.1020887,21.942579 6.1140851,21.987142 C 6.216716,22.368386 5.6030802,21.818968 5.9792184,21.737809 z" id="ink" style="fill:#2f2e30" />
<use transform="translate(10.990002,3.8538026e-8)" id="use76" x="0" y="0" width="48" height="48" xlink:href="#ink" />
<path d="M 5.5115148,11.404657 C 5.5115148,12.395102 5.8060968,12.515559 6.5418278,12.725249 C 10.247608,13.781433 8.5745991,21.449773 16.649696,21.449773 C 21.457822,21.449773 21.710843,19.503061 19.997396,18.44071 L 16.501082,18.692392 C 13.43174,9.9966217 14.733047,11.759287 14.733047,10.108546 z" id="path78" style="fill:#161108;fill-opacity:0.2" />
<path d="M 11.082788,3.5564373 C 12.217227,8.325497 14.173725,5.5803913 15.547475,10.202461 C 16.019223,11.789686 15.576678,12.407558 16.921226,12.843643 C 20.398192,13.971349 18.518179,22.499012 26.880914,20.724125 C 23.217291,9.7794808 24.578546,12.166066 24.578546,10.515325 z" id="path80" style="fill:#161108;fill-opacity:0.2" />
<g id="g3823">
<path d="M 4.4421621,0.98716345 C 2.2017593,0.98716345 0.99538862,1.8215217 0.99538862,2.9896233 L 0.99538862,3.65711 C 0.99538862,4.3245966 1.5124046,4.9920832 2.374098,4.9920832 C 4.2698234,4.9920832 5.4754001,6.9945433 5.4761941,8.3295164 L 5.4780009,11.367248 C 5.4786274,12.420664 7.6852449,11.212757 8.9036883,14.720331 C 10.259139,18.622312 12.432999,21.011762 16.850546,21.011762 C 19.607965,21.011762 20.020573,20.3697 20.020573,19.034726 L 20.020573,17.394668 C 20.020573,16.56031 19.458337,16.034271 18.424305,16.034271 C 16.791359,16.034271 17.149304,17.064159 16.338458,17.064159 C 15.451342,17.064159 14.599789,14.591031 14.189171,13.259916 C 13.377971,10.630219 14.819853,11.237929 14.72594,10.399773 L 14.471703,8.1307513 C 14.346782,7.015849 14.437805,7.1614148 11.680386,6.9945431 C 10.216116,2.7379412 7.3719195,0.98716345 4.4421621,0.98716345 z" id="path83" style="fill:url(#linearGradient3661)" />
<path d="M 4.96875,2 C 3.2057707,2 2,2.3325134 2,3 C 2,3.6642519 2.0765353,3.9375 2.5625,3.9375 C 4.2491594,3.9375 3.4545381,2.9680543 5.125,2.9375 C 6.2633663,2.9166782 7.4824003,4.4696364 8.4157839,8 L 6.0625,8.03125 L 6.09375,9.03125 L 8.8220339,9.0625 C 11.450626,16.216872 13.743186,19 16.84375,19 C 18.835543,19 19.03125,18.510177 19.03125,17.96875 C 19.03125,17.635007 19.064355,17.03125 18.375,17.03125 C 17.24978,17.03125 17.831936,18 16.625,18 C 15.082493,18 14.564816,16.718588 13.625,14.34375 L 11.5,9.03125 L 14,8.96875 L 13.96875,8 L 11.09375,8 C 9.7579717,4.266134 7.6726079,2 4.96875,2 z M 5.53125,5.03125 C 5.3317239,5.0836168 5.1278342,5.2194678 4.9375,5.4375 C 5.6520584,5.8208907 5.8483684,6.3924021 6.03125,7.03125 C 6.2354674,6.9947284 6.5161895,7.0547753 6.96875,7 C 6.7930562,5.6798054 6.1298283,4.8741495 5.53125,5.03125 z M 7.1080509,11.03072 C 7.8449043,11.226074 8.7790547,11.72166 8.9475636,12.106462 L 8.4788136,11.034428 z" id="path85" style="fill:url(#linearGradient3063)" />
<path d="M 4.737878,2.2090834 C 2.702128,2.2090834 2.231109,2.8180889 2.231109,3.1610863 C 2.231109,3.4948296 2.2562104,3.6533682 2.8270824,3.6533682 C 3.8934274,3.6533682 3.4325249,2.694572 5.2312709,2.694572 C 6.6100219,2.694572 7.7006703,4.6773786 8.8174679,8.2652208 L 6.3484982,8.2948979 L 6.3394263,8.7685037 L 9.0320285,8.8265074 C 11.036237,14.644262 13.710545,18.811986 16.666663,18.811986 C 18.505913,18.811986 18.758479,18.360777 18.758479,18.005805 C 18.758479,17.546221 18.668217,17.277372 18.366625,17.277372 C 17.465792,17.277372 18.138042,18.2429 16.554291,18.2429 C 15.283294,18.2429 14.53979,17.202646 13.581449,14.83512 L 11.142895,8.8108114 L 13.740634,8.7739876 L 13.703106,8.2539164 L 10.921874,8.2613347 C 9.3707065,3.7225704 7.0684884,2.2090834 4.737878,2.2090834 z" id="path87" style="fill:none;stroke:url(#linearGradient3655);stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
<use transform="translate(10,0)" id="use3828" x="0" y="0" width="32" height="32" xlink:href="#g3823" />
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

34
README-MS.html Normal file → Executable file
View File

@ -85,39 +85,7 @@ it is the least expected part.
and libxml2.
<P>
Most of what you need you get by default. But you must explicitly request
X11 and the libraries. Scroll down the list of catagories:
<UL>
<LI>
Near (or at) the bottom, click on the [+] beside X11. Then make sure the
following are selected:
<UL>
<LI>
X-startup-scripts
<LI>
XFree86-lib-compat
<LI>
xorg-x11-base
<LI>
xorg-x11-bin
<LI>
xorg-x11-dlls
<LI>
xorg-x11-lndir
<LI>
xorg-x11-etc
<LI>
xorg-x11-f100
<LI>
xorg-x11-libs-data
<LI>
xorg-x11-xwin
<LI>
xterm
</UL>
</UL>
<LI>
<P>
Do something similar for each of the libraries.
X11 and the libraries.
<P>
Once you have cygwin installed, start it. This should give you a terminal
window running bash (a unix shell)

34
README-Mac.html Normal file → Executable file
View File

@ -65,7 +65,7 @@
<A NAME="Before">Before</A> you install
</H3>
<P>
You must ensure that you have the the X11 server installed on your system.
You must ensure that you have the X11 server installed on your system.
<DL>
<DT>
10.5, 10.4
@ -144,6 +144,29 @@ below for more info on this)
Control rather than command. This isn't very mac-like. If you turn <B>off</B>
the "<CODE>Enable keyboard shortcuts under X11</CODE>" preference item then
fontforge will configure its menubar to make use of Command.
<P>
If type the following into a terminal (or xterm) window
<BLOCKQUOTE id="shell">
<PRE><FONT COLOR="Gray">$ </FONT>cat >~/.fonts.conf
&lt;?xml version="1.0"?>
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd">
&lt;!-- /etc/fonts/fonts.conf file to configure system font access -->
&lt;fontconfig>
&lt;!-- Font directory list -->
&lt;!-- Add to system list -->
&lt;dir>/System/Library/Fonts&lt;/dir>
&lt;dir>/Library/Fonts&lt;/dir>
&lt;dir>~/Library/Fonts&lt;/dir>
&lt;/fontconfig>
<b>^D</b>
</PRE>
</BLOCKQUOTE>
<P>
then fontforge's UI will be able to use the fonts Apple supplies with the mac.
(You don't type the "$", and ^D means hold down the control key and press "D").
<H4>
Note:
</H4>
@ -745,8 +768,9 @@ The value of the PATH variable is a set of directories separated by colons.
</PRE>
</BLOCKQUOTE>
<P>
Unfortunately there are two ways of doing this because there are two different
conventions used by unix shells. Type:
Unfortunately there are several ways of doing this because there are two different
conventions used by unix shells. And the mac has yet a third way which only works
sometimes. Type:
<BLOCKQUOTE>
<PRE><FONT COLOR="Gray">$ </FONT>echo $SHELL
/bin/bash
@ -788,6 +812,10 @@ setenv PATH /usr/local/bin:$PATH
^D
</PRE>
</BLOCKQUOTE>
<P>
On the mac you may also want to download the <a href="http://www.apple.com/downloads/macosx/system_disk_utilities/environmentvariablepreferencepane.html">environment
preference plugin</a> and install the environment variable there. Note if you
ssh into your mac this setting will not be noticed.
<H3>
<A NAME="Starting">Starting</A> fontforge from the command line
</H3>

0
README-Unix.html Normal file → Executable file
View File

View File

@ -32,8 +32,6 @@ INSTALLATION WITHOUT DYNAMIC LIBRARIES
A README file or two
fontforge -- the executable
fontforge.1 -- the man page.
pfaedit-*.ui -- various user interface string files for different
languages
You should:
$ su
# mkdir -p /usr/local/bin /usr/local/man/man1 /usr/local/share/fontforge

View File

@ -33,7 +33,7 @@ struct arabicforms ArabicForms[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0, 0, 0 },
{ 0x061e, 0x061e, 0x061e, 0x061e, 0, 0, 0 },
{ 0x061f, 0x061f, 0x061f, 0x061f, 0, 0, 0 },
{ 0x0000, 0x0000, 0x0000, 0x0000, 0, 0, 0 },
{ 0x0620, 0x0620, 0x0620, 0x0620, 1, 0, 0 },
{ 0x0621, 0x0621, 0x0621, 0xfe80, 1, 0, 0 },
{ 0x0622, 0x0622, 0xfe82, 0xfe81, 1, 0, 0 },
{ 0x0623, 0x0623, 0xfe84, 0xfe83, 1, 0, 0 },
@ -96,7 +96,7 @@ struct arabicforms ArabicForms[] = {
{ 0x065c, 0x065c, 0x065c, 0x065c, 0, 0, 0 },
{ 0x065d, 0x065d, 0x065d, 0x065d, 0, 0, 0 },
{ 0x065e, 0x065e, 0x065e, 0x065e, 0, 0, 0 },
{ 0x0000, 0x0000, 0x0000, 0x0000, 0, 0, 0 },
{ 0x065f, 0x065f, 0x065f, 0x065f, 0, 0, 0 },
{ 0x0660, 0x0660, 0x0660, 0x0660, 0, 0, 0 },
{ 0x0661, 0x0661, 0x0661, 0x0661, 0, 0, 0 },
{ 0x0662, 0x0662, 0x0662, 0x0662, 0, 0, 0 },

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
@ -8,7 +10,7 @@ VPATH = @srcdir@
bindir = @bindir@
GU_VERSION=3
GU_REVISION=1
GU_REVISION=2
GU_AGE=0
LIBTOOL = @LIBTOOL@
@ -22,7 +24,7 @@ Incs = -I$(top_srcdir)/inc -I../inc -I/usr/pkg/include -I/usr/pkg/include/giflib
CFLAGS = @CFLAGS@ @CPPFLAGS@ $(Incs) @WFLAGS@ @DEFS@
../libgunicode.la: $(libgunicode_OBJECTS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -no-undefined @LDFLAGS@ -o ../libgunicode.la $(libgunicode_OBJECTS) \
$(LIBTOOL) --mode=link $(CC) -no-undefined @LDFLAGS@ -o ../libgunicode.la $(libgunicode_OBJECTS) \
@LIBS@ \
-rpath $(libdir) -version-info $(GU_VERSION):$(GU_REVISION):$(GU_AGE)
@ -30,7 +32,7 @@ CFLAGS = @CFLAGS@ @CPPFLAGS@ $(Incs) @WFLAGS@ @DEFS@
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
clean:
-rm -f *.o *.lo ../libgunicode.la .libs/*
-rm -fr *.o *.lo ../libgunicode.la .libs/* .libs
distclean cleaner:
-rm -f *.o *.lo ../libgunicode.la .libs/* Makefile
-rm -f *.o *.lo ../libgunicode.la .libs/* .libs Makefile

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@

48
Unicode/README.TXT Normal file
View File

@ -0,0 +1,48 @@
UPDATING FONTFORGE'S SUPPORT FOR UNICODE
Thanks to Thanks to Khaled Hosny for reverse-engineering this.
To update unicode coverage, run:
wget http://unicode.org/Public/UNIDATA/LineBreak.txt
wget http://unicode.org/Public/UNIDATA/NamesList.txt
wget http://unicode.org/Public/UNIDATA/PropList.txt
wget http://unicode.org/Public/UNIDATA/UnicodeData.txt
make makeutype
./makeutype
rm *.txt
UPDATING FONTFORGE'S ROUTINES FOR RE-ENCODING
There is a little program dump.c to update reencoding tables. It needs some
external files to work. Here is my best attempt to find these files. You will
notice that some files are still lacking. I couldn't find them.
Thanks to Jose Da Silva for asking, what's it for. To make use of this, run:
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-4.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-9.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-10.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-12.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-14.TXT
wget http://unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT
wget http://unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
mv KOI8-R.TXT koi8r.TXT
wget http://unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0201.TXT
mv JIS0201.TXT JIS0201.txt
wget http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/zdingbat.txt
mv zdingbat.txt zapfding.TXT
wget http://unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0212.TXT
gcc -s -o dump dump.c
./dump
rm *.txt *.TXT

View File

@ -1107,8 +1107,8 @@ const unichar_t unicode_from_jis208[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x9fa5, 0x1c2a, 0xbfffee18, 0x4204f04f,
0x804ef70, 0x0000, 0x2288, 0x804f240, 0x42130a14, 0x40015360, 0xbfffee38, 0x804bcc9
0x0000, 0x0000, 0x0000, 0x0000, 0x9fa5, 0x1c2a, 0xbfffdb88, 0x4204f04f,
0x804ef70, 0x0000, 0x2288, 0x804f240, 0x42130a14, 0x40015360, 0xbfffdba8, 0x804bcc9
};
const unichar_t unicode_from_jis212[] = {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -51,12 +51,12 @@ int almaps[] = { em_iso8859_1, em_iso8859_2, em_iso8859_3, em_iso8859_4,
char *cjk[] = { "JIS0208.TXT", "JIS0212.TXT", "BIG5.TXT", "GB2312.TXT",
"HANGUL.TXT", "Big5HKSCS.txt", NULL };
/* I'm only paying attention to Wansung encoding (in HANGUL.TXT) which is 94x94 */
/* I used to look at OLD5601, but that maps to Unicode 1.0, and Hangul's moved*/
/* I used to look at OLD5601, but that maps to Unicode 1.0, and Hangul's moved */
char *adobecjk[] = { "aj16cid2code.txt", "aj20cid2code.txt", "ac15cid2code.txt",
"ag15cid2code.txt", "ak12cid2code.txt", NULL };
/* I'm told that most of the mappings provided on the Unicode site go to */
/* Unicode 1.* and that CJK have been moved radically since. So instead */
/* of the unicode site's files, try using adobe's which claim they are */
/* of the unicode site's files, try using Adobe's which claim they are */
/* up to date. These may be found in: */
/* ftp://ftp.ora.com/pub/examples/nutshell/ujip/adobe/samples/{aj14,aj20,ak12,ac13,ag14}/cid2code.txt */
/* they may be bundled up in a tar file, I forget exactly... */
@ -65,35 +65,43 @@ int cjkmaps[] = { em_jis208, em_jis212, em_big5, em_gb2312, em_ksc5601, em_big5h
unsigned long *used[256];
const char CantReadFile[] = "Can't find or read file %s\n";
const char CantSaveFile[] = "Can't open or write to output file %s\n";
const char NoMoreMemory[] = "Can't access more memory.\n";
static void dumpalphas(FILE *output, FILE *header) {
FILE *file;
int i,j,k, first, last;
long _orig, _unicode, mask;
unichar_t unicode[256];
unsigned char *table[256], *plane;
char buffer[200];
char buffer[200+1];
fprintf(output, "#include <chardata.h>\n\n" );
fprintf(output, "const unsigned char c_allzeros[256] = { 0 };\n\n" );
buffer[200]='\0';
for ( k=0; k<256; ++k ) table[k] = NULL;
for ( j=0; alphabets[j]!=NULL; ++j ) {
file = fopen( alphabets[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", alphabets[j]);
fprintf( stderr, CantReadFile, alphabets[j]);
} else {
for ( i=0; i<160; ++i )
unicode[i] = i;
for ( ; i<256; ++i )
unicode[i] = 0;
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
sscanf(buffer, "0x%lx 0x%lx", (unsigned long *) &_orig, (unsigned long *) &_unicode);
unicode[_orig] = _unicode;
if ( table[_unicode>>8]==NULL ) {
plane = table[_unicode>>8] = calloc(256,1);
if ((plane = table[_unicode>>8] = calloc(256,1))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
if ( j==0 && (_unicode>>8)==0 )
for ( k=0; k<256; ++k )
plane[k] = k;
@ -103,7 +111,10 @@ static void dumpalphas(FILE *output, FILE *header) {
}
table[_unicode>>8][_unicode&0xff] = _orig;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
if ( almaps[j]!=-1 )
used[_unicode>>8][_unicode&0xff] |= (1<<almaps[j]);
@ -341,17 +352,18 @@ static void dumpjis(FILE *output,FILE *header) {
long _orig, _unicode;
unichar_t unicode208[94*94], unicode212[94*94];
unichar_t *table[256], *plane;
char buffer[400];
char buffer[400+1];
memset(table,0,sizeof(table));
buffer[400]='\0';
j=0;
file = fopen( adobecjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", adobecjk[j]);
fprintf( stderr, CantReadFile, adobecjk[j]);
} else {
memset(unicode208,0,sizeof(unicode208));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
_orig = getnth(buffer,2);
@ -367,7 +379,10 @@ static void dumpjis(FILE *output,FILE *header) {
continue;
}
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
table[_unicode>>8][_unicode&0xff] = _orig;
_orig -= 0x2121;
_orig = (_orig>>8)*94 + (_orig&0xff);
@ -376,7 +391,10 @@ static void dumpjis(FILE *output,FILE *header) {
else {
unicode208[_orig] = _unicode;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<em_jis208);
}
@ -387,10 +405,10 @@ static void dumpjis(FILE *output,FILE *header) {
j=1;
file = fopen( adobecjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", adobecjk[j]);
fprintf( stderr, CantReadFile, adobecjk[j]);
} else {
memset(unicode212,0,sizeof(unicode212));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
_orig = getnth(buffer,2);
@ -406,7 +424,10 @@ static void dumpjis(FILE *output,FILE *header) {
continue;
}
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
if ( table[_unicode>>8][_unicode&0xff]==0 )
table[_unicode>>8][_unicode&0xff] = _orig|0x8000;
else
@ -418,7 +439,10 @@ static void dumpjis(FILE *output,FILE *header) {
else {
unicode212[_orig] = _unicode;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<em_jis212);
}
@ -484,18 +508,18 @@ static void dumpbig5(FILE *output,FILE *header) {
long _orig, _unicode;
unichar_t unicode[0x6000];
unichar_t *table[256], *plane;
char buffer[400];
j = 2;
memset(table,0,sizeof(table));
char buffer[400+1];
file = fopen( adobecjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", adobecjk[j]);
fprintf( stderr, CantReadFile, adobecjk[j]);
} else {
j = 2;
buffer[400]='\0';
memset(table,0,sizeof(table));
memset(unicode,0,sizeof(unicode));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
_orig = getnth(buffer,3);
@ -528,10 +552,16 @@ static void dumpbig5(FILE *output,FILE *header) {
}
unicode[_orig-0xa100] = _unicode;
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
table[_unicode>>8][_unicode&0xff] = _orig;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<em_big5);
}
@ -586,18 +616,18 @@ static void dumpbig5hkscs(FILE *output,FILE *header) {
long _orig, _unicode;
unichar_t unicode[0x8000];
unichar_t *table[256], *plane;
char buffer[400];
j=5;
memset(table,0,sizeof(table));
char buffer[400+1];
file = fopen( cjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", cjk[j] );
fprintf( stderr, CantReadFile, cjk[j] );
} else {
j=5;
buffer[400]='\0';
memset(table,0,sizeof(table));
memset(unicode,0,sizeof(unicode));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
if ( sscanf( buffer, "U+%lx: %lx", (unsigned long *) &_unicode, (unsigned long *) &_orig )!=2 )
@ -610,10 +640,16 @@ static void dumpbig5hkscs(FILE *output,FILE *header) {
}
unicode[_orig-0x8100] = _unicode;
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
table[_unicode>>8][_unicode&0xff] = _orig;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<em_big5hkscs);
}
@ -668,19 +704,21 @@ static void dumpWansung(FILE *output,FILE *header) {
long _orig, _unicode, _johab;
unichar_t unicode[94*94], junicode[0x7c00];
unichar_t *table[256], *plane, *jtable[256];
char buffer[400];
char buffer[400+1];
/* Johab high=[0x84-0xf9] low=[0x31-0xfe] */
buffer[400]='\0';
memset(table,0,sizeof(table));
memset(jtable,0,sizeof(jtable));
file = fopen( adobecjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", adobecjk[j]);
fprintf( stderr, CantReadFile, adobecjk[j]);
} else {
memset(unicode,0,sizeof(unicode));
memset(junicode,0,sizeof(junicode));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
_johab = getnth(buffer,7);
@ -702,7 +740,10 @@ static void dumpWansung(FILE *output,FILE *header) {
}
if ( _orig>=0x2121 && (_orig&0xff)>=0x21 && _orig<=0x7e7e && (_orig&0xff)<=0x7e ) {
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
table[_unicode>>8][_unicode&0xff] = _orig;
_orig -= 0x2121;
_orig = (_orig>>8)*94 + (_orig&0xff);
@ -712,18 +753,27 @@ static void dumpWansung(FILE *output,FILE *header) {
}
unicode[_orig] = _unicode;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<cjkmaps[j]);
}
if ( _johab>=0x8431 && _johab<=0xf9fe ) {
if ( jtable[_unicode>>8]==NULL )
jtable[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((jtable[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
jtable[_unicode>>8][_unicode&0xff] = _johab;
_johab -= 0x8400;
junicode[_johab] = _unicode;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<em_johab);
}
@ -829,17 +879,18 @@ static void dumpgb2312(FILE *output,FILE *header) {
long _orig, _unicode;
unichar_t unicode[94*94];
unichar_t *table[256], *plane;
char buffer[400];
char buffer[400+1];
buffer[400]='\0';
memset(table,0,sizeof(table));
j = 3;
file = fopen( adobecjk[j], "r" );
if ( file==NULL ) {
fprintf( stderr, "Can't open %s\n", adobecjk[j]);
fprintf( stderr, CantReadFile, adobecjk[j]);
} else {
memset(unicode,0,sizeof(unicode));
while ( fgets(buffer,sizeof(buffer),file)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,file)!=NULL ) {
if ( buffer[0]=='#' )
continue;
_orig = getnth(buffer,2);
@ -855,13 +906,19 @@ static void dumpgb2312(FILE *output,FILE *header) {
continue;
}
if ( table[_unicode>>8]==NULL )
table[_unicode>>8] = calloc(256,sizeof(unichar_t));
if ((table[_unicode>>8] = calloc(256,sizeof(unichar_t)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
table[_unicode>>8][_unicode&0xff] = _orig;
_orig -= 0x2121;
_orig = (_orig>>8)*94 + (_orig&0xff);
unicode[_orig] = _unicode;
if ( used[_unicode>>8]==NULL ) {
used[_unicode>>8] = calloc(256,sizeof(long));
if ((used[_unicode>>8] = calloc(256,sizeof(long)))==NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
}
used[_unicode>>8][_unicode&0xff] |= (1<<cjkmaps[j]);
}
@ -958,12 +1015,13 @@ int main(int argc, char **argv) {
FILE *output, *header;
if (( output = fopen( "alphabet.c", "w" ))==NULL ) {
fprintf( stderr, "Can't open %s\n", "alphabet.c" );
fprintf( stderr, CantSaveFile, "alphabet.c" );
return 1;
}
if (( header = fopen( "chardata.h", "w" ))==NULL ) {
fprintf( stderr, "Can't open %s\n", "chardata.h" );
return 1;
fprintf( stderr, CantSaveFile, "chardata.h" );
fclose(output);
return 1;
}
fprintf( header, "#include \"basics.h\"\n\n" );
@ -975,18 +1033,21 @@ return 1;
fclose(output);
if (( output = fopen( "cjk.c", "w" ))==NULL ) {
fprintf( stderr, "Can't open %s\n", "cjk.c" );
fprintf( stderr, CantSaveFile, "cjk.c" );
fclose(header);
return 1;
}
dumpcjks(output,header);
fclose(output);
if (( output = fopen( "backtrns.c", "w" ))==NULL ) {
fprintf( stderr, "Can't open %s\n", "cjk.c" );
fprintf( stderr, CantSaveFile, "backtrns.c" );
fclose(header);
return 1;
}
dumptrans(output,header);
/* This really should be in make ctype, but putting it there causes all */
/* sorts of build problems in things happen out of order */
/* sorts of build problems in things when they happen out of order */
fprintf( header,"\nextern const unichar_t *const * const unicode_alternates[];\n" );
fclose(output); fclose(header);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2008 by George Williams */
/* Copyright (C) 2004-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -1,140 +0,0 @@
/* Copyright (C) 2000-2008 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <basics.h>
#include <intl.h>
char *sgettext(const char *msgid) {
const char *msgval = _(msgid);
char *found;
if (msgval == msgid)
if ( (found = strrchr (msgid, '|'))!=NULL )
msgval = found+1;
return (char *) msgval;
}
#if defined( HAVE_LIBINTL_H ) && !defined( NODYNAMIC ) && !defined ( _STATIC_LIBINTL )
# include <dynamic.h>
static DL_CONST void *libintl = NULL;
static char *(*_bind_textdomain_codeset)(const char *, const char *);
static char *(*_bindtextdomain)(const char *, const char *);
static char *(*_textdomain)(const char *);
static char *(*_gettext)(const char *);
static char *(*_ngettext)(const char *, const char *, unsigned long int);
static char *(*_dgettext)(const char *, const char *);
static int init_gettext(void) {
if ( libintl == (void *) -1 )
return( false );
else if ( libintl !=NULL )
return( true );
libintl = dlopen("libintl" SO_EXT,RTLD_LAZY);
#ifdef SO_1_EXT
if ( libintl==NULL )
libintl = dlopen("libintl" SO_1_EXT,RTLD_LAZY);
#endif
if ( libintl==NULL ) {
libintl = (void *) -1;
return( false );
}
_bind_textdomain_codeset = (char *(*)(const char *, const char *)) dlsym(libintl,"bind_textdomain_codeset");
_bindtextdomain = (char *(*)(const char *, const char *)) dlsym(libintl,"bindtextdomain");
_textdomain = (char *(*)(const char *)) dlsym(libintl,"textdomain");
_gettext = (char *(*)(const char *)) dlsym(libintl,"gettext");
_ngettext = (char *(*)(const char *, const char *, unsigned long int)) dlsym(libintl,"ngettext");
_dgettext = (char *(*)(const char *, const char *)) dlsym(libintl,"dgettext");
if ( _bind_textdomain_codeset==NULL || _bindtextdomain==NULL ||
_textdomain==NULL || _gettext==NULL || _ngettext==NULL ) {
libintl = (void *) -1;
fprintf( stderr, "Found a copy of libintl but could not use it.\n" );
return( false );
}
return( true );
}
char *gwwv_bind_textdomain_codeset(const char *domain, const char *dir) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 )
return( (_bind_textdomain_codeset)(domain,dir));
return( NULL );
}
char *gwwv_bindtextdomain(const char *domain, const char *dir) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 )
return( (_bindtextdomain)(domain,dir));
return( NULL );
}
char *gwwv_textdomain(const char *domain) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 )
return( (_textdomain)(domain));
return( NULL );
}
char *gwwv_gettext(const char *msg) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 )
return( (_gettext)(msg));
return( (char *) msg );
}
char *gwwv_ngettext(const char *msg, const char *pmsg,unsigned long int n) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 )
return( (_ngettext)(msg,pmsg,n));
return( (char *) (n==1?msg:pmsg) );
}
char *gwwv_dgettext(const char *domain, const char *msg) {
if ( libintl==NULL )
init_gettext();
if ( libintl!=(void *) -1 && _dgettext!=NULL )
return( (_dgettext)(domain,msg));
return( (char *) msg );
}
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -25,6 +25,33 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This program generates 4 different files based on the latest UnicodeData.txt
* obtained from http://unicode.org which is then used to build FontForge
*
* To generate the latest files, you will first need to go and get these 4 files
* and put them in the Unicode subdirectory:
* http://unicode.org/Public/UNIDATA/LineBreak.txt
* http://unicode.org/Public/UNIDATA/NamesList.txt
* http://unicode.org/Public/UNIDATA/PropList.txt
* http://unicode.org/Public/UNIDATA/UnicodeData.txt
*
* Next, you will need to build ./makeutype before you can use it:
* Run "make makeutype"
* or
* Run "gcc -s -I../inc -o makeutype makeutype.c"
*
* Then run the executable binary "/makeutype".
* This will create 4 files in the same directory:
* ArabicForms.c, unialt.c, utype.c, utype.h
* (please move utype.h into Fontforge's "inc" subdirectory)
*
* When done building the updated files, you can clean-up by removing
* LineBreak.txt, NamesList.txt, PropList.txt,UnicodeData.txt, and the
* binary executable file makeutype as they are no longer needed now.
*/
/* Build a ctype array out of the UnicodeData.txt and PropList.txt files */
#include <stdio.h>
#include <stdlib.h>
@ -99,6 +126,11 @@ unsigned int flags2[MAXC];
unichar_t alts[MAXC][MAXA+1];
int assignedcodepoints[0x120000/32];
const char GeneratedFileMessage[] = "\n/* This file was generated using the program 'makeutype' */\n\n";
const char CantReadFile[] = "Can't find or read file %s\n";
const char CantSaveFile[] = "Can't open or write to output file %s\n";
const char NoMoreMemory[] = "Can't access more memory.\n";
static void FigureAlternates(unichar_t index, char *apt, int normative) {
int alt, i;
char *end;
@ -161,17 +193,18 @@ return;
}
static void readin(void) {
char buffer[300], buf2[300], oldname[100], *pt, *end, *pt1;
char buffer[300+1], buf2[300+1], oldname[100+1], *pt, *end, *pt1;
int index, lc, uc, tc, flg, val, cc, indexend;
int wasfirst;
FILE *fp;
int i,j;
buffer[300]='\0'; buf2[300]='\0'; oldname[100]='\0';
if ((fp = fopen("UnicodeData.txt","r"))==NULL ) {
fprintf( stderr, "Can't find UnicodeData.txt\n" );
fprintf( stderr, CantReadFile,"UnicodeData.txt" );
exit(1);
}
while ( fgets(buffer,sizeof(buffer),fp)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,fp)!=NULL ) {
if ( *buffer=='#' )
continue;
flg = 0;
@ -305,10 +338,10 @@ static void readin(void) {
fclose(fp);
if ((fp = fopen("LineBreak.txt","r"))==NULL ) {
fprintf( stderr, "Can't find LineBreak.txt\n" );
fprintf( stderr, CantReadFile, "LineBreak.txt" );
exit(1);
}
while ( fgets(buffer,sizeof(buffer),fp)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,fp)!=NULL ) {
if ( *buffer=='#' )
continue;
flg = 0;
@ -362,10 +395,10 @@ static void readin(void) {
fclose(fp);
if ((fp = fopen("PropList.txt","r"))==NULL ) {
fprintf( stderr, "Can't find PropList.txt\n" );
fprintf( stderr, CantReadFile, "PropList.txt" );
exit(1);
}
while ( fgets(buffer,sizeof(buffer),fp)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,fp)!=NULL ) {
flg = 0;
if ( true || strncmp(buffer,"Property dump for:", strlen("Property dump for:"))==0 ) {
if ( strstr(buffer, "(Zero-width)")!=NULL || strstr(buffer, "ZERO WIDTH")!=NULL )
@ -409,10 +442,10 @@ static void readin(void) {
flags[0xFEFF] |= _NOBREAK;
if ((fp = fopen("NamesList.txt","r"))==NULL ) {
fprintf( stderr, "Can't find NamesList.txt\n" );
fprintf( stderr, CantReadFile, "NamesList.txt" );
exit(1);
}
while ( fgets(buffer,sizeof(buffer),fp)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,fp)!=NULL ) {
flg = 0;
if ( (index = strtol(buffer,NULL,16))!=0 ) {
if ( strstr(buffer, "COMBINING")!=NULL )
@ -435,15 +468,16 @@ static void readin(void) {
}
static void readcorpfile(char *prefix, char *corp) {
char buffer[300], buf2[300], *pt, *end, *pt1;
char buffer[300+1], buf2[300+1], *pt, *end, *pt1;
int index;
FILE *fp;
buffer[300]='\0'; buf2[300]='\0';
if ((fp = fopen(corp,"r"))==NULL ) {
fprintf( stderr, "Can't find %s\n", corp ); /* Not essential */
fprintf( stderr, CantReadFile, corp ); /* Not essential */
return;
}
while ( fgets(buffer,sizeof(buffer),fp)!=NULL ) {
while ( fgets(buffer,sizeof(buffer)-1,fp)!=NULL ) {
if ( *buffer=='#' )
continue;
/* code */
@ -461,7 +495,10 @@ return;
FigureAlternates(index,pt, false);
if ( index>=MAXC )
break;
names[index]= malloc(strlen(buf2)+strlen(prefix)+4);
if ((names[index]= malloc(strlen(buf2)+strlen(prefix)+4)) == NULL) {
fprintf( stderr, NoMoreMemory );
exit(3);
}
strcpy(names[index],prefix); strcat(names[index],buf2);
}
}
@ -469,9 +506,10 @@ return;
}
static int find(char *base, char *suffix) {
char name[300];
char name[300+1];
int i;
name[300]='\0';
strcpy(name,base);
strcat(name,suffix);
@ -526,12 +564,15 @@ static void dumparabicdata(FILE *header) {
data = fopen( "ArabicForms.c","w");
if ( data==NULL || data==NULL ) {
fprintf( stderr, "Can't open output file ArabicForms.c\n" );
fprintf( stderr, CantSaveFile, "ArabicForms.c" );
exit(2);
}
fprintf( data, "#include <utype.h>\n" );
fprintf( data, "\nstruct arabicforms ArabicForms[] = {\n" );
fprintf( data, GeneratedFileMessage );
fprintf( data, "struct arabicforms ArabicForms[] = {\n" );
for ( i=0; i<256; ++i ) {
fprintf( data, "\t{ 0x%04x, 0x%04x, 0x%04x, 0x%04x, %d, %d, %d }%s\n",
forms[i].initial, forms[i].medial, forms[i].final, forms[i].isolated,
@ -550,12 +591,47 @@ static void dump() {
data = fopen("utype.c","w");
if ( header==NULL || data==NULL ) {
fprintf( stderr, "Can't open output files (utype.[ch])\n" );
fprintf( stderr, CantSaveFile, "(utype.[ch])" );
exit(2);
}
fprintf( header, "#ifndef _UTYPE_H\n" );
fprintf( header, "#define _UTYPE_H\n\n" );
fprintf( header, "#define _UTYPE_H\n" );
fprintf( header, GeneratedFileMessage );
fprintf( header, "#include <ctype.h>\t\t/* Include here so we can control it. If a system header includes it later bad things happen */\n" );
fprintf( header, "#ifdef tolower\n" );
fprintf( header, "# undef tolower\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef toupper\n" );
fprintf( header, "# undef toupper\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef islower\n" );
fprintf( header, "# undef islower\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef isupper\n" );
fprintf( header, "# undef isupper\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef isalpha\n" );
fprintf( header, "# undef isalpha\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef isdigit\n" );
fprintf( header, "# undef isdigit\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef isalnum\n" );
fprintf( header, "# undef isalnum\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef isspace\n" );
fprintf( header, "# undef isspace\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef ispunct\n" );
fprintf( header, "# undef ispunct\n" );
fprintf( header, "#endif\n" );
fprintf( header, "#ifdef ishexdigit\n" );
fprintf( header, "# undef ishexdigit\n" );
fprintf( header, "#endif\n\n" );
fprintf( header, "#define ____L 0x%0x\n", _LOWER );
fprintf( header, "#define ____U 0x%0x\n", _UPPER );
fprintf( header, "#define ____TITLE 0x%0x\n", _TITLE );
@ -657,7 +733,8 @@ static void dump() {
fprintf( header, "\n" );
fprintf( data, "#include \"utype.h\"\n\n" );
fprintf( data, "#include \"utype.h\"\n" );
fprintf( data, GeneratedFileMessage );
fprintf( data, "const unsigned short ____tolower[]= { 0,\n " );
for ( i=0; i<MAXC; i+=j ) {
for ( j=0; j<8 && i+j<MAXC-1; ++j )
@ -745,11 +822,13 @@ static void dump() {
#if 0
data = fopen( "uninames.c", "w");
if ( data==NULL ) {
fprintf( stderr, "Cannot open uninames.c for output\n" );
fprintf( stderr, CantSaveFile, "uninames.c" );
exit( 1 );
}
fprintf( data, "#include <stdio.h>\n" );
fprintf( data, "#include <utype.h>\n\n" );
fprintf( data, "#include <utype.h>\n" );
fprintf( data, GeneratedFileMessage );
for ( i=0; i<MAXC; ++i ) if ( names[i]!=NULL && *names[i]!='<' ) {
fprintf( data, "static const unsigned short _%04x[] = { ", i );
for ( j=0; names[i][j]!='\0'; ++j )
@ -811,11 +890,13 @@ static void dump_alttable() {
FILE *file;
if (( file = fopen("unialt.c","w" ))==NULL ) {
fprintf(stderr, "Can't open file for alternates\n" );
fprintf(stderr, CantSaveFile, "unialt.c" );
return;
}
fprintf(file, "#include <chardata.h>\n\n" );
fprintf(file, "#include <chardata.h>\n" );
fprintf(file, GeneratedFileMessage );
for ( i=32; i<MAXC; ++i ) {
if ( alts[i][0]!=0 ) {
@ -853,10 +934,11 @@ return;
fprintf(file, "0};\n" );
fclose(file);
#if 0 /* moved to dump.c to make build process easier */
#if 0 /* moved to dump.c to make build process easier */
/* Now only one thing touches chardata. Even though it's our entry */
/* best if done elsewhere */
file = fopen("chardata.h","a");
fprintf( file, GeneratedFileMessage );
fprintf( file,"\nextern const unichar_t *const * const unicode_alternates[];\n" );
fclose(file);
#endif
@ -867,7 +949,7 @@ static void visualalts(void) {
/* These non-normative decompositions allow display algorithems to */
/* pick something that looks right, even if the character doesn't mean */
/* what it should. For example Alpha LOOKS LIKE A so if we don't have */
/* an Alpha character avaiable we can draw it with an A. But this decomp */
/* an Alpha character available we can draw it with an A. But this decomp */
/* is not normative and should not be used for ordering purposes */
/* ligatures */
@ -939,7 +1021,7 @@ static void visualalts(void) {
alts[0x3c1][0] = 'p';
alts[0x3c7][0] = 'x';
alts[0x405][0] = 'S'; /* Cyrillic */
alts[0x405][0] = 'S'; /* Cyrillic */
alts[0x406][0] = 'I';
alts[0x408][0] = 'J';
alts[0x410][0] = 'A';
@ -969,7 +1051,7 @@ static void visualalts(void) {
alts[0x456][0] = 'i';
alts[0x458][0] = 'j';
alts[0x470][0] = 0x3a8; /* extended cyrillic */
alts[0x470][0] = 0x3a8; /* extended Cyrillic */
alts[0x471][0] = 0x3c8;
alts[0x4ae][0] = 'Y';
alts[0x4c0][0] = 'I';
@ -1004,7 +1086,7 @@ static void visualalts(void) {
alts[0x6d4][0] = 0xb7;
/* Many of the Korean Jamo are ligatures of other Jamo */
/* 0x110b often, but not always, rides underneath (0x1135 it's left) */
/* 0x110b often, but not always, rides underneath (0x1135 it's left) */
/* Chosung */
alts[0x1101][0] = 0x1100; alts[0x1101][1] = 0x1100;
alts[0x1104][0] = 0x1103; alts[0x1104][1] = 0x1103;
@ -1267,7 +1349,7 @@ static void visualalts(void) {
alts[0x2126][0] = 0x3a9;
alts[0x2205][0] = 0xd8; /* Mathematical operators */
alts[0x2205][0] = 0xd8; /* Mathematical operators */
alts[0x2206][0] = 0x394;
alts[0x220f][0] = 0x3a0;
alts[0x2211][0] = 0x3a3;
@ -1288,9 +1370,9 @@ static void visualalts(void) {
alts[0x22c5][0] = 0xb7;
alts[0x22ef][0] = 0xb7; alts[0x22ef][1] = 0xb7; alts[0x22ef][2] = 0xb7;
alts[0x2303][0] = '^'; /* Misc Technical */
alts[0x2303][0] = '^'; /* Misc Technical */
alts[0x2373][0] = 0x3b9; /* APL greek */
alts[0x2373][0] = 0x3b9; /* APL greek */
alts[0x2374][0] = 0x3c1;
alts[0x2375][0] = 0x3c9;
alts[0x237a][0] = 0x3b1;
@ -1346,7 +1428,7 @@ static void visualalts(void) {
alts[0x2758][0] = '|';
alts[0x2762][0] = '!';
alts[0x3001][0] = ','; /* Idiographic symbols */
alts[0x3001][0] = ','; /* Idiographic symbols */
alts[0x3008][0] = '<';
alts[0x3009][0] = '>';
alts[0x300a][0] = 0xab;
@ -1612,7 +1694,7 @@ static void cheat(void) {
mymirror[0x207E] = 0x207D;
mymirror[0x208D] = 0x208E; /* subscript paren */
mymirror[0x208E] = 0x208D;
/* mathmatical symbols not mirrorred!!!! some tech symbols missing too */
/* mathematical symbols not mirrorred!!!! some tech symbols missing too */
/* no code points */
mymirror[0x2308] = 0x2309; /* ceiling */
mymirror[0x2309] = 0x2308;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,9 +24,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef VMS /* these three lines from Jacob Jansen, Open VMS port */
# include <vms_jackets.h>
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@ -419,7 +416,7 @@ static int BytesNormal(iconv_t latin1_2_unicode) {
} u[8];
#else
union {
int s;
int32 s;
char c[4];
} u[8];
#endif

View File

@ -1549,6 +1549,14 @@ static const unichar_t str_2091[] = { 0x0065, 0 };
static const unichar_t str_2092[] = { 0x006f, 0 };
static const unichar_t str_2093[] = { 0x0078, 0 };
static const unichar_t str_2094[] = { 0x0259, 0 };
static const unichar_t str_2095[] = { 0x0068, 0 };
static const unichar_t str_2096[] = { 0x006b, 0 };
static const unichar_t str_2097[] = { 0x006c, 0 };
static const unichar_t str_2098[] = { 0x006d, 0 };
static const unichar_t str_2099[] = { 0x006e, 0 };
static const unichar_t str_209a[] = { 0x0070, 0 };
static const unichar_t str_209b[] = { 0x0073, 0 };
static const unichar_t str_209c[] = { 0x0074, 0 };
static const unichar_t str_20a8[] = { 0x0052, 0x0073, 0 };
static const unichar_t str_2100[] = { 0x0061, 0x002f, 0x0063, 0 };
static const unichar_t str_2101[] = { 0x0061, 0x002f, 0x0073, 0 };
@ -1606,6 +1614,9 @@ static const unichar_t str_2146[] = { 0x0064, 0 };
static const unichar_t str_2147[] = { 0x0065, 0 };
static const unichar_t str_2148[] = { 0x0069, 0 };
static const unichar_t str_2149[] = { 0x006a, 0 };
static const unichar_t str_2150[] = { 0x0031, 0x2044, 0x0037, 0 };
static const unichar_t str_2151[] = { 0x0031, 0x2044, 0x0039, 0 };
static const unichar_t str_2152[] = { 0x0031, 0x2044, 0x0031, 0x0030, 0 };
static const unichar_t str_2153[] = { 0x0031, 0x2044, 0x0033, 0 };
static const unichar_t str_2154[] = { 0x0032, 0x2044, 0x0033, 0 };
static const unichar_t str_2155[] = { 0x0031, 0x2044, 0x0035, 0 };
@ -1651,6 +1662,7 @@ static const unichar_t str_217c[] = { 0x006c, 0 };
static const unichar_t str_217d[] = { 0x0063, 0 };
static const unichar_t str_217e[] = { 0x0064, 0 };
static const unichar_t str_217f[] = { 0x006d, 0 };
static const unichar_t str_2189[] = { 0x0030, 0x2044, 0x0033, 0 };
static const unichar_t str_219a[] = { 0x2190, 0x0338, 0 };
static const unichar_t str_219b[] = { 0x2192, 0x0338, 0 };
static const unichar_t str_21ae[] = { 0x2194, 0x0338, 0 };
@ -2382,6 +2394,10 @@ static const unichar_t str_3240[] = { 0x0028, 0x796d, 0x0029, 0 };
static const unichar_t str_3241[] = { 0x0028, 0x4f11, 0x0029, 0 };
static const unichar_t str_3242[] = { 0x0028, 0x81ea, 0x0029, 0 };
static const unichar_t str_3243[] = { 0x0028, 0x81f3, 0x0029, 0 };
static const unichar_t str_3244[] = { 0x554f, 0x20dd, 0 };
static const unichar_t str_3245[] = { 0x5e7c, 0x20dd, 0 };
static const unichar_t str_3246[] = { 0x6587, 0x20dd, 0 };
static const unichar_t str_3247[] = { 0x7b8f, 0x20dd, 0 };
static const unichar_t str_3250[] = { 0x0050, 0x0054, 0x0045, 0 };
static const unichar_t str_3251[] = { 0x0032, 0x0031, 0x20dd, 0 };
static const unichar_t str_3252[] = { 0x0032, 0x0032, 0x20dd, 0 };
@ -3162,6 +3178,9 @@ static const unichar_t str_fa67[] = { 0x9038, 0 };
static const unichar_t str_fa68[] = { 0x96e3, 0 };
static const unichar_t str_fa69[] = { 0x97ff, 0 };
static const unichar_t str_fa6a[] = { 0x983b, 0 };
static const unichar_t str_fa6b[] = { 0x6075, 0 };
static const unichar_t str_fa6c[] = { 0x242ee, 0 };
static const unichar_t str_fa6d[] = { 0x8218, 0 };
static const unichar_t str_fa70[] = { 0x4e26, 0 };
static const unichar_t str_fa71[] = { 0x51b5, 0 };
static const unichar_t str_fa72[] = { 0x5168, 0 };
@ -5963,7 +5982,15 @@ str_2091,
str_2092,
str_2093,
str_2094,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_20a8,
str_2095,
str_2096,
str_2097,
str_2098,
str_2099,
str_209a,
str_209b,
str_209c,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_20a8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static const unichar_t * const tab_21[] = {
@ -6023,7 +6050,10 @@ str_2146,
str_2147,
str_2148,
str_2149,
0, 0, 0, 0, 0, 0, 0, 0, 0, str_2153,
0, 0, 0, 0, 0, 0, str_2150,
str_2151,
str_2152,
str_2153,
str_2154,
str_2155,
str_2156,
@ -6068,7 +6098,8 @@ str_217c,
str_217d,
str_217e,
str_217f,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_219a,
0, 0, 0, 0, 0, 0, 0, 0, 0, str_2189,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_219a,
str_219b,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_21ae,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_21cd,
@ -6841,7 +6872,11 @@ str_3240,
str_3241,
str_3242,
str_3243,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, str_3250,
str_3244,
str_3245,
str_3246,
str_3247,
0, 0, 0, 0, 0, 0, 0, 0, str_3250,
str_3251,
str_3252,
str_3253,
@ -7633,7 +7668,10 @@ str_fa67,
str_fa68,
str_fa69,
str_fa6a,
0, 0, 0, 0, 0, str_fa70,
str_fa6b,
str_fa6c,
str_fa6d,
0, 0, str_fa70,
str_fa71,
str_fa72,
str_fa73,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001-2008 by George Williams */
/* Copyright (C) 2001-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -386,7 +386,7 @@ double u_strtod(const unichar_t *str, unichar_t **ptr) {
double val;
extern double strtod(); /* Please don't delete this, not all of us have good ansi headers */
for ( upt=str, pt=buf; *upt<128 && *upt!='\0'; )
for ( upt=str, pt=buf; *upt<128 && *upt!='\0' && pt-buf<sizeof(buf)-1; )
*pt++ = *upt++;
*pt = '\0';
val = strtod(buf,&ret);
@ -739,7 +739,7 @@ char *u2utf8_copy(const unichar_t *ubuf) {
return( NULL );
len = u_strlen(ubuf);
utf8buf = galloc((len+1)*3);
utf8buf = galloc((len+1)*4);
return( u2utf8_strcpy(utf8buf,ubuf));
}
@ -750,7 +750,7 @@ char *u2utf8_copyn(const unichar_t *ubuf,int len) {
if ( ubuf==NULL )
return( NULL );
utf8buf = pt = galloc((len+1)*3);
utf8buf = pt = galloc((len+1)*4);
for ( i=0; i<len && *ubuf!='\0'; ++i )
pt = utf8_idpb(pt, *ubuf++);
*pt = '\0';
@ -843,6 +843,24 @@ return( false );
return( true );
}
void utf8_truncatevalid(char *str) {
/* There are certain cases where we have a fixed amount of space to display */
/* something, and if it doesn't fit in that, then we truncate it. But... */
/* that can leave us with a half completed utf8 byte sequence. So truncate*/
/* again, right before the start of the bad sequence */
int ch;
char *old;
old = str;
while ( (ch=utf8_ildb((const char **) &str))!='\0' ) {
if ( ch==-1 ) {
*old = '\0';
return;
}
old = str;
}
}
char *utf8_db(char *utf8_text) {
/* Decrement utf8 pointer */
unsigned char *pt = (unsigned char *) utf8_text;
@ -888,3 +906,83 @@ int utf82u_strlen(const char *utf8_str) {
++len;
return( len );
}
#include <chardata.h>
char *StripToASCII(const char *utf8_str) {
/* Remove any non-ascii characters: Special case, convert the copyright symbol to (c) */
char *newcr, *pt, *end;
int len, ch;
const unichar_t *alt;
len = strlen(utf8_str);
pt = newcr = galloc(len+1);
end = pt+len;
while ( (ch= utf8_ildb(&utf8_str))!='\0' ) {
if ( pt>=end ) {
int off = pt-newcr;
newcr = grealloc(newcr,(off+10)+1);
pt = newcr+off;
end = pt+10;
}
if ( (ch>=' ' && ch<'\177' ) || ch=='\n' || ch=='\t' )
*pt++ = ch;
else if ( ch=='\r' && *utf8_str!='\n' )
*pt++ = '\n';
else if ( ch==0xa9 /* Copyright sign */ ) {
char *str = "(c)";
if ( pt+strlen(str)>=end ) {
int off = pt-newcr;
newcr = grealloc(newcr,(off+10+strlen(str))+1);
pt = newcr+off;
end = pt+10;
}
while ( *str )
*pt++ = *str++;
} else if ( unicode_alternates[ch>>8]!=NULL &&
(alt = unicode_alternates[ch>>8][ch&0xff])!=NULL ) {
while ( *alt!='\0' ) {
if ( pt>=end ) {
int off = pt-newcr;
newcr = grealloc(newcr,(off+10)+1);
pt = newcr+off;
end = pt+10;
}
if ( *alt>=' ' && *alt<'\177' )
*pt++ = *alt;
else if ( *alt==0x300 )
*pt++ = '`';
else if ( *alt==0x301 )
*pt++ = '\'';
else if ( *alt==0x302 )
*pt++ = '^';
else if ( *alt==0x303 )
*pt++ = '~';
else if ( *alt==0x308 )
*pt++ = ':';
++alt;
}
}
}
*pt = '\0';
return( newcr );
}
int AllAscii(const char *txt) {
for ( ; *txt!='\0'; ++txt ) {
if ( *txt=='\t' || *txt=='\n' || *txt=='\r' )
/* All right */;
else if ( *txt<' ' || *txt>='\177' )
return( false );
}
return( true );
}
int uAllAscii(const unichar_t *txt) {
for ( ; *txt!='\0'; ++txt ) {
if ( *txt=='\t' || *txt=='\n' || *txt=='\r' )
/* All right */;
else if ( *txt<' ' || *txt>='\177' )
return( false );
}
return( true );
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
20081224
20120731-b

9961
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

28066
configure vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
orig_args="$*"
AC_INIT(fontforge/pfaedit.h)
AC_INIT(fontforge/fontforge.h)
AC_CONFIG_HEADERS([inc/config.h])
AC_PROG_CC
AC_PROG_INSTALL
@ -46,6 +46,7 @@ gww_ismac="no"
gww_iscygwin="no"
gww_needsstaticimages="no"
gww_rpath=""
gww_archlist=""
AC_ARG_WITH(static-imagelibs,
[ --with-static-imagelibs Control whether to try using static image libaries],
[
@ -57,6 +58,8 @@ AC_ARG_WITH(static-imagelibs,
])
oldCPPFLAGS="$CPPFLAGS"
gww_extraincludes=""
oldLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
@ -68,16 +71,23 @@ case "$host" in
AC_DEFINE(__Mac,1)
MACAPP=FontForge.app/Contents/Info.plist
gww_define_caps_for_alt="1"
if test "$no_x" = "yes"; then
MACAPP=""
fi
dnl fink puts stuff under /sw
dnl macports puts stuff under /opt/local
dnl but when macport/fink overwrite a standard lib, I still want the standard
dnl library to be found (otherwise only portable to machines with macports/fink)
if test "$CPPFLAGS" \!= "" >/dev/null ; then
TrustUser="yes"
elif test -d /sw/include >/dev/null ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
CPPFLAGS="$CPPFLAGS -I /sw/include"
gww_extraincludes="/sw/include"
elif test -d /opt/local/include >/dev/null ; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
CPPFLAGS="$CPPFLAGS -I /opt/local/include"
gww_extraincludes="/opt/local/include";
fi
if test "$oldLDFLAGS" \!= "" >/dev/null ; then
TrustUser="yes"
@ -134,7 +144,34 @@ esac
AC_C_BIGENDIAN()
AC_PROG_LIBTOOL
LT_INIT
AC_ARG_ENABLE(arch-i386,
[ --enable-arch-i386 (Mac only) build for i386 machines],
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch i386"
fi
])
AC_ARG_ENABLE(arch-x86_64,
[ --enable-arch-x86_64 (Mac only) build for 64bit x86 machines],
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch x86_64"
fi
])
AC_ARG_ENABLE(arch-ppc,
[ --enable-arch-ppc (Mac only) build for PPC machines],
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch ppc"
fi
])
AC_ARG_WITH(capslock-for-alt,
[ --with-capslock-for-alt Control whether to use capslock rather than alt/meta to alter behavior of tools in outline/bitmap windows],
@ -177,7 +214,10 @@ AC_SUBST(FF_EXTRA_FILES)
AC_SEARCH_LIBS(dlopen, dl) dnl some systems have this in libc (Darwin uses dyld)
AC_SEARCH_LIBS(inet_aton, resolv) dnl some systems have this in libc
if test "$gww_uselessiconv" = "no" ; then
AC_SEARCH_LIBS(libiconv, iconv) dnl linux has iconv in libc, mac,solaris have libiconv in libiconv, and a define to map iconv() to libiconv(), so we can't do the obvious check
# on some systems "iconv()" lives in libc. On others it lives in libiconv
# on older systems "libiconv()" lives in libiconv
AC_SEARCH_LIBS(iconv, iconv,,
AC_SEARCH_LIBS(libiconv, iconv,,gww_uselessiconv="yes"))
fi
python="yes"
@ -210,24 +250,25 @@ if test "$python" = "yes" ; then
fi
], : )
AC_ARG_WITH(python-lib,
[ --with-python-lib Specify the python shared libary],
[ --with-python-lib Specify the python shared library],
[
if test "$withval" != "no" -a "$withval" != "yes" -a "$withval" != "" >/dev/null 2>&1 ; then
py_lib="$withval"
fi
], : )
echo -n "Checking for python..."
if $python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')" ; then
PyVersion=`$python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')"`
PySubVersion=`echo $PyVersion |sed -e 's/2.//'`
if $python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('VERSION'))" ; then
PyVersion=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('VERSION'))"`
PyMajorVersion=`echo $PyVersion |sed -e 's/\..*//'`
PySubVersion=`echo $PyVersion |sed -e 's/2\.//' -e 's/3\.//'`
PyName="python$PyVersion"
if test "$PySubVersion" = "" ; then
python="no"
elif test "$PySubVersion" -le 2 ; then
elif test "$PyMajorVersion" -le 2 -a "$PySubVersion" -le 2 ; then
python="no"
echo $ECHO_N "(need at least python 2.3) $ECHO_C" >&6
else
PyInc=`$python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('INCLUDEPY')"`
PyInc=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('INCLUDEPY'))"`
if test "$py_headers" != "" -a -e "$py_headers" ; then
CPPFLAGS="$CPPFLAGS -I$py_headers"
elif test "$PyInc" != "" -a -e "$PyInc" ; then
@ -239,7 +280,7 @@ if test "$python" = "yes" ; then
else
python="no"
fi
PyLib=`$python_prog -c "import distutils.sysconfig ; print '%s/%s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'))"`
PyLib=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('LIBPL') + '/' + distutils.sysconfig.get_config_var('LDLIBRARY'))"`
if test "$py_lib" != "" ; then
LIBS="$LIBS $py_lib"
elif test "$PyLib" != "" -a -e "$PyLib" ; then
@ -357,8 +398,12 @@ dnl bloody useless thing to do, but check for both (don't need to check for
dnl zlib.h because we never use it directly, only used inside libpng)
AC_CHECK_LIB(z, deflateEnd, : ,AC_DEFINE(_NO_LIBPNG), -lm)
AC_CHECK_LIB(png, png_create_read_struct, : ,[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12), AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)
AC_CHECK_LIB(png16, png_create_read_struct, AC_DEFINE(_LIBPNG16),[
AC_CHECK_LIB(png15, png_create_read_struct, AC_DEFINE(_LIBPNG15),[
AC_CHECK_LIB(png14, png_create_read_struct, AC_DEFINE(_LIBPNG14),[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12),[
AC_CHECK_LIB(png, png_create_read_struct, : ,
AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)
AC_CHECK_HEADER(png.h, : , AC_DEFINE(_NO_LIBPNG))
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, : ,AC_DEFINE(_NO_LIBJPEG))
AC_CHECK_HEADER(jpeglib.h, : , AC_DEFINE(_NO_LIBJPEG))
@ -403,10 +448,12 @@ if test "$gww_checkcairo" = "yes" ; then
gww_CFLAGS=$CFLAGS
gww_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
LDFLAGS="$X_LIBS $LDFLAGS"
AC_CHECK_HEADER(fontconfig/fontconfig.h, [
AC_CHECK_LIB(fontconfig, FcConfigCreate, [
AC_CHECK_LIB(cairo, cairo_xlib_surface_create, gww_hascairo="yes" )])])
AC_CHECK_LIB(cairo, cairo_set_scaled_font, gww_hascairo="yes" )])])
#I used to check for cairo_xlib_surface_create, but that's in version 1.0 too
# cairo_set_scaled_font is not in 1.0 (fontforge needs at least 1.2)
CFLAGS=$gww_CFLAGS
LDFLAGS=$gww_LDFLAGS
fi
@ -516,7 +563,7 @@ AC_ARG_ENABLE(freetype,
if test "$gww_use_freetype" != "no" >/dev/null 2>&1 ; then
AC_CHECK_LIB(freetype, FT_New_Memory_Face, : , [
gww_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -L/usr/X11/lib"
dnl Avoid configure's cache.
unset ac_cv_lib_freetype_FT_New_Memory_Face
@ -619,8 +666,8 @@ dnl and not all libintls have that. So check for it instead.
dnl sometimes it lives in libc so we can't dlopen it
gww_has_gettext="yes"
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE( _STATIC_LIBINTL ) , [
AC_CHECK_LIB(intl, bind_textdomain_codeset,: ,gww_has_gettext="no" )])
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE(_STATIC_LIBINTL) , [
AC_CHECK_LIB(intl, bind_textdomain_codeset,LIBS="$LIBS -lintl" ,gww_has_gettext="no" )])
if test $gww_has_gettext = yes >/dev/null ; then
AC_CHECK_HEADERS([libintl.h], : , gww_has_gettext="no")
fi
@ -633,6 +680,10 @@ AC_ARG_WITH(regular-link,
gww_regular_link="yes"
AC_DEFINE(NODYNAMIC)
gww_rpath=""
if test "$gww_extraincludes" != "" ; then
CPPFLAGS=`echo $CPPFLAGS | sed -e "s%-idirafter $gww_extraincludes%%"`
CPPFLAGS="$CPPFLAGS -I$gww_extraincludes"
fi
fi
], : )
@ -657,6 +708,12 @@ if test "$gww_nodynamic" = "yes" -o "$gww_regular_link" = "yes"; then
if test "$ac_cv_lib_png12_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng12 -lz"
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng14 -lz"
fi
if test "$ac_cv_lib_png15_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng15 -lz"
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -ltiff"
fi
@ -709,6 +766,10 @@ if test "$gww_needsstaticimages" = "yes" -a "$gww_regular_link" = "no"; then
STATIC_LIBS="$STATIC_LIBS -lpng12 -lz"
AC_DEFINE(_STATIC_LIBPNG)
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng14 -lz"
AC_DEFINE(_STATIC_LIBPNG)
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -ltiff"
AC_DEFINE(_STATIC_LIBTIFF)
@ -748,6 +809,12 @@ case "$host" in
if test "$ac_cv_lib_png12_png_create_read_struct" = "yes"; then
AC_CHECK_LIB_LA(png12, :, [ STATIC_LIBS="$STATIC_LIBS -lpng12 -lz" ; AC_DEFINE(_STATIC_LIBPNG12)])
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
AC_CHECK_LIB_LA(png14, :, [ STATIC_LIBS="$STATIC_LIBS -lpng14 -lz" ; AC_DEFINE(_STATIC_LIBPNG14)])
fi
if test "$ac_cv_lib_png15_png_create_read_struct" = "yes"; then
AC_CHECK_LIB_LA(png15, :, [ STATIC_LIBS="$STATIC_LIBS -lpng15 -lz" ; AC_DEFINE(_STATIC_LIBPNG15)])
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
AC_CHECK_LIB_LA(tiff, :, [ STATIC_LIBS="$STATIC_LIBS -ltiff" ; AC_DEFINE(_STATIC_LIBTIFF)])
fi
@ -857,6 +924,12 @@ dnl a pity.
dnl Build a $ac_confdir/po/Makefile.in with appropriate instructions for installing all locales
MACKEYS=
if ! msgfmt --help >/dev/null 2>&1 ; then
dnl even if the library is installed, the executables might not be. Or might
dnl not be in the PATH.
gww_has_gettext="no";
fi
if test "$gww_has_gettext" = "yes" >/dev/null 2>&1 ; then
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
mofiles="$(cd $ac_confdir/po/mackeys && ls *.po | sed -e 's#\.po#\.mo#g')"
@ -941,9 +1014,11 @@ fi
PY=
if test "$gww_dopy" = "yes" >/dev/null 2>&1 ; then
AC_SUBST(PYINCLUDE)
AC_SUBST(PYPREFIX)
AC_SUBST(PYDEFINES)
AC_SUBST(PYLIBS)
PYINCLUDE=
PYPREFIX="$real_prefix"
PYDEFINES="('PREFIX','\"$real_prefix\"')"
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
PYDEFINES="$PYDEFINES, ('__Mac','1')"
@ -963,6 +1038,12 @@ if test -e gtkui/Makefile.in -a \( -e /usr/include/gtk-2.0/gtk/gtk.h -o -e /sw/i
GTFF=gtkui/Makefile
fi
if test "$gww_archlist" != "" ; then
CFLAGS="$CFLAGS $gww_archlist"
LDFLAGS="$LDFLAGS $gww_archlist"
fi
AC_SUBST(CFLAGS_NOOPT)
CFLAGS_NOOPT=`echo $CFLAGS | sed -e s/-O.//g | sed -e s/-O//g`
cp $ac_confdir/Makefile.dynamic.in $ac_confdir/Makefile.in
cp $ac_confdir/Unicode/Makefile.dynamic.in $ac_confdir/Unicode/Makefile.in

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
orig_args="$*"
AC_INIT(fontforge/pfaedit.h)
AC_INIT(fontforge/fontforge.h)
AC_CONFIG_HEADERS([inc/config.h])
AC_PROG_CC
AC_PROG_INSTALL
@ -46,8 +46,9 @@ gww_ismac="no"
gww_iscygwin="no"
gww_needsstaticimages="no"
gww_rpath=""
gww_archlist=""
AC_ARG_WITH(static-imagelibs,
[ --with-static-imagelibs Control whether to try using static image libaries],
AS_HELP_STRING([--with-static-imagelibs],[Control whether to try using static image libaries]),
[
if test "$withval" \!= "no" ; then
gww_needsstaticimages="yes"
@ -57,6 +58,8 @@ AC_ARG_WITH(static-imagelibs,
])
oldCPPFLAGS="$CPPFLAGS"
gww_extraincludes=""
oldLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
@ -68,16 +71,23 @@ case "$host" in
AC_DEFINE(__Mac,1)
MACAPP=FontForge.app/Contents/Info.plist
gww_define_caps_for_alt="1"
if test "$no_x" = "yes"; then
MACAPP=""
fi
dnl fink puts stuff under /sw
dnl macports puts stuff under /opt/local
dnl but when macport/fink overwrite a standard lib, I still want the standard
dnl library to be found (otherwise only portable to machines with macports/fink)
if test "$CPPFLAGS" \!= "" >/dev/null ; then
TrustUser="yes"
elif test -d /sw/include >/dev/null ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
CPPFLAGS="$CPPFLAGS -I /sw/include"
gww_extraincludes="/sw/include"
elif test -d /opt/local/include >/dev/null ; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
CPPFLAGS="$CPPFLAGS -I /opt/local/include"
gww_extraincludes="/opt/local/include";
fi
if test "$oldLDFLAGS" \!= "" >/dev/null ; then
TrustUser="yes"
@ -95,7 +105,7 @@ dnl macports puts stuff under /opt/local
dnl it and we get undefined symbols.
;;
powerpc-*-*linux*)
powerpc*-*-*linux*)
AC_DEFINE(_Keyboard,3)
;;
*sparc*)
@ -134,10 +144,37 @@ esac
AC_C_BIGENDIAN()
AC_PROG_LIBTOOL
LT_INIT
AC_ARG_ENABLE(arch-i386,
AS_HELP_STRING([--enable-arch-i386],[(Mac only) build for i386 machines]),
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch i386"
fi
])
AC_ARG_ENABLE(arch-x86_64,
AS_HELP_STRING([--enable-arch-x86_64],[(Mac only) build for 64bit x86 machines]),
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch x86_64"
fi
])
AC_ARG_ENABLE(arch-ppc,
AS_HELP_STRING([--enable-arch-ppc],[(Mac only) build for PPC machines]),
[
if test "$enableval" \!= "no" ; then
gww_archlist="$gww_archlist -arch ppc"
fi
])
AC_ARG_WITH(capslock-for-alt,
[ --with-capslock-for-alt Control whether to use capslock rather than alt/meta to alter behavior of tools in outline/bitmap windows],
AS_HELP_STRING([--with-capslock-for-alt],[Control whether to use capslock rather than alt/meta to alter behavior of tools in outline/bitmap windows]),
[
if test "$withval" \!= "2" ; then
gww_define_caps_for_alt="2"
@ -152,7 +189,7 @@ if test "$gww_define_caps_for_alt" \!= "dontknow" ; then
fi
AC_ARG_ENABLE(debug-raw-points,
[ --enable-debug-raw-points Add a raw mode to the points window of the debugger],
AS_HELP_STRING([--enable-debug-raw-points],[Add a raw mode to the points window of the debugger]),
[
if test "$enableval" \!= "no" ; then
AC_DEFINE(FONTFORGE_CONFIG_SHOW_RAW_POINTS)
@ -165,7 +202,7 @@ dnl to work.
gww_uselessiconv="no"
AC_ARG_WITH(iconv,
[ --without-iconv Don't use the system's iconv(3) routines, use fontforge's instead],
AS_HELP_STRING([--without-iconv],[Don't use the system's iconv(3) routines, use fontforge's instead]),
[
if test "$withval" = "no" ; then
gww_uselessiconv="yes"
@ -177,13 +214,16 @@ AC_SUBST(FF_EXTRA_FILES)
AC_SEARCH_LIBS(dlopen, dl) dnl some systems have this in libc (Darwin uses dyld)
AC_SEARCH_LIBS(inet_aton, resolv) dnl some systems have this in libc
if test "$gww_uselessiconv" = "no" ; then
AC_SEARCH_LIBS(libiconv, iconv) dnl linux has iconv in libc, mac,solaris have libiconv in libiconv, and a define to map iconv() to libiconv(), so we can't do the obvious check
# on some systems "iconv()" lives in libc. On others it lives in libiconv
# on older systems "libiconv()" lives in libiconv
AC_SEARCH_LIBS(iconv, iconv,,
AC_SEARCH_LIBS(libiconv, iconv,,gww_uselessiconv="yes"))
fi
python="yes"
python_prog="python"
AC_ARG_WITH(python,
[ --without-python Don't include a python interpreter],
AS_HELP_STRING([--without-python],[Don't include a python interpreter]),
[
if test "$withval" = "no" >/dev/null 2>&1 ; then
python="no"
@ -200,7 +240,7 @@ if test "$python" = "yes" ; then
py_headers=""
py_lib=""
AC_ARG_WITH(python-headers,
[ --with-python-headers Specify the directory containing the python headers],
AS_HELP_STRING([--with-python-headers],[Specify the directory containing the python headers]),
[
if test "$withval" != "no" >/dev/null 2>&1 ; then
py_headers="$withval"
@ -210,24 +250,25 @@ if test "$python" = "yes" ; then
fi
], : )
AC_ARG_WITH(python-lib,
[ --with-python-lib Specify the python shared libary],
AS_HELP_STRING([--with-python-lib],[Specify the python shared library]),
[
if test "$withval" != "no" -a "$withval" != "yes" -a "$withval" != "" >/dev/null 2>&1 ; then
py_lib="$withval"
fi
], : )
echo -n "Checking for python..."
if $python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')" ; then
PyVersion=`$python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')"`
PySubVersion=`echo $PyVersion |sed -e 's/2.//'`
if $python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('VERSION'))" ; then
PyVersion=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('VERSION'))"`
PyMajorVersion=`echo $PyVersion |sed -e 's/\..*//'`
PySubVersion=`echo $PyVersion |sed -e 's/2\.//' -e 's/3\.//'`
PyName="python$PyVersion"
if test "$PySubVersion" = "" ; then
python="no"
elif test "$PySubVersion" -le 2 ; then
elif test "$PyMajorVersion" -le 2 -a "$PySubVersion" -le 2 ; then
python="no"
echo $ECHO_N "(need at least python 2.3) $ECHO_C" >&6
else
PyInc=`$python_prog -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('INCLUDEPY')"`
PyInc=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('INCLUDEPY'))"`
if test "$py_headers" != "" -a -e "$py_headers" ; then
CPPFLAGS="$CPPFLAGS -I$py_headers"
elif test "$PyInc" != "" -a -e "$PyInc" ; then
@ -239,7 +280,7 @@ if test "$python" = "yes" ; then
else
python="no"
fi
PyLib=`$python_prog -c "import distutils.sysconfig ; print '%s/%s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'))"`
PyLib=`$python_prog -c "import distutils.sysconfig ; print(distutils.sysconfig.get_config_var('LIBPL') + '/' + distutils.sysconfig.get_config_var('LDLIBRARY'))"`
if test "$py_lib" != "" ; then
LIBS="$LIBS $py_lib"
elif test "$PyLib" != "" -a -e "$PyLib" ; then
@ -257,7 +298,7 @@ fi
gww_dopy=no
gww_fflib=yes
AC_ARG_ENABLE(libff,
AC_HELP_STRING(--enable-libff, disable/enable building shared fontforge library),
AC_HELP_STRING([--enable-libff],[disable/enable building shared fontforge library]),
[
case $enableval in
no)
@ -271,7 +312,7 @@ fi
AC_DEFINE_UNQUOTED(PYTHON_LIB_NAME,"python$PyVersion")
AC_ARG_ENABLE(pyextension,
AC_HELP_STRING(--enable-pyextension, disable/enable installing libfontforge as a python extension plugin),
AC_HELP_STRING([--enable-pyextension],[disable/enable installing libfontforge as a python extension plugin]),
[
case $enableval in
yes)
@ -297,7 +338,7 @@ fi
ffscript="yes"
AC_ARG_WITH(native-script,
[ --without-native-script Don't include a legacy fontforge scripting interpreter],
AS_HELP_STRING([--without-native-script],[Don't include a legacy fontforge scripting interpreter]),
[
if test "$withval" = "no" >/dev/null 2>&1 ; then
ffscript="no"
@ -357,8 +398,12 @@ dnl bloody useless thing to do, but check for both (don't need to check for
dnl zlib.h because we never use it directly, only used inside libpng)
AC_CHECK_LIB(z, deflateEnd, : ,AC_DEFINE(_NO_LIBPNG), -lm)
AC_CHECK_LIB(png, png_create_read_struct, : ,[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12), AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)
AC_CHECK_LIB(png16, png_create_read_struct, AC_DEFINE(_LIBPNG16),[
AC_CHECK_LIB(png15, png_create_read_struct, AC_DEFINE(_LIBPNG15),[
AC_CHECK_LIB(png14, png_create_read_struct, AC_DEFINE(_LIBPNG14),[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12),[
AC_CHECK_LIB(png, png_create_read_struct, : ,
AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)
AC_CHECK_HEADER(png.h, : , AC_DEFINE(_NO_LIBPNG))
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, : ,AC_DEFINE(_NO_LIBJPEG))
AC_CHECK_HEADER(jpeglib.h, : , AC_DEFINE(_NO_LIBJPEG))
@ -393,7 +438,7 @@ dnl Do we have libcairo
gww_hascairo="no"
gww_checkcairo="yes"
AC_ARG_WITH(cairo,
[ --without-cairo Don't use libcairo],
AS_HELP_STRING([--without-cairo],[Don't use libcairo]),
[
if test "$withval" = "no" ; then
gww_checkcairo="no"
@ -403,7 +448,7 @@ if test "$gww_checkcairo" = "yes" ; then
gww_CFLAGS=$CFLAGS
gww_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
LDFLAGS="$X_LIBS $LDFLAGS"
AC_CHECK_HEADER(fontconfig/fontconfig.h, [
AC_CHECK_LIB(fontconfig, FcConfigCreate, [
AC_CHECK_LIB(cairo, cairo_set_scaled_font, gww_hascairo="yes" )])])
@ -434,7 +479,7 @@ gww_haspangocairo="no"
gww_checkpango="yes"
gww_has_pkg_config="yes"
AC_ARG_WITH(pango,
[ --without-pango Don't use libpango],
AS_HELP_STRING([--without-pango],[Don't use libpango]),
[
if test "$withval" = "no" ; then
gww_checkpango="no"
@ -444,7 +489,7 @@ if test "$gww_checkpango" = "yes" ; then
pan_headers=""
pan_lib=""
AC_ARG_WITH(pango-headers,
[ --with-pango-headers=dirs Specify the CPPFLAGS needed to compile pango],
AS_HELP_STRING([--with-pango-headers=dirs],[Specify the CPPFLAGS needed to compile pango]),
[
if test "$withval" != "no" -a "$withval" != "yes" >/dev/null 2>&1 ; then
pan_headers="$withval"
@ -452,7 +497,7 @@ if test "$gww_checkpango" = "yes" ; then
fi
], : )
AC_ARG_WITH(pango-lib,
[ --with-pango-lib Specify LDFLAGS needed to link with pango],
AS_HELP_STRING([--with-pango-lib],[Specify LDFLAGS needed to link with pango]),
[
if test "$withval" != "no" -a "$withval" != "yes" >/dev/null 2>&1 ; then
pan_lib="$withval"
@ -494,7 +539,7 @@ elif test "$gww_haspango" = "done" ; then
fi
AC_ARG_ENABLE(macapp,
[ --disable-macapp Do not build a mac Application (only for macs)],
AS_HELP_STRING([--disable-macapp],[Do not build a mac Application (only for macs)]),
[
if test "$enableval" = "no" >/dev/null 2>&1 ; then
MACAPP=
@ -507,7 +552,7 @@ dnl many systems have freetype on /usr/X11R6/lib which isn't in the standard sea
gww_use_freetype="yes"
gww_hasbytecode="no"
AC_ARG_ENABLE(freetype,
[ --disable-freetype Control whether we build with freetype],
AS_HELP_STRING([--disable-freetype],[Control whether we build with freetype]),
[
if test "$enableval" = "no" >/dev/null 2>&1 ; then
AC_DEFINE(_NO_FREETYPE)
@ -518,7 +563,7 @@ AC_ARG_ENABLE(freetype,
if test "$gww_use_freetype" != "no" >/dev/null 2>&1 ; then
AC_CHECK_LIB(freetype, FT_New_Memory_Face, : , [
gww_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib"
LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -L/usr/X11/lib"
dnl Avoid configure's cache.
unset ac_cv_lib_freetype_FT_New_Memory_Face
@ -533,7 +578,7 @@ if test "$gww_use_freetype" != "no" >/dev/null 2>&1 ; then
if test "$ac_cv_lib_freetype_FT_New_Memory_Face" = "yes" ; then
AC_ARG_WITH(freetype-bytecode,
[ --with-freetype-bytecode Control whether we build with the bytecode interpreter],
AS_HELP_STRING([--with-freetype-bytecode],[Control whether we build with the bytecode interpreter]),
[
gww_hasbytecode="$withval"
],
@ -557,8 +602,8 @@ AC_CHECK_LIB(pthread, pthread_create,
if test \( "$gww_hasbytecode" = "yes" \) -a \( "$FreeType2_IncRoot" != "" \); then
gww_hasbytecode="no"
AC_ARG_WITH(freetype-src,
[ --with-freetype-src=dir Specify freetype source directory],
[
AS_HELP_STRING([--with-freetype-src=DIR],[Freetype source files are in DIR]),
[
if test "$withval" != "no" >/dev/null 2>&1 ; then
FreeType2_TT_BUILD_INC="$withval/src/truetype"
# if test "${FreeType2_TT_BUILD_INC:0:1}" != "/" ; then
@ -573,7 +618,7 @@ if test \( "$gww_hasbytecode" = "yes" \) -a \( "$FreeType2_IncRoot" != "" \); th
echo "Unable to find $FreeType2_TT_BUILD_INC/ttobjs.h"
fi
fi
],
],
[
dnl guess directory
AC_MSG_CHECKING(trying to find the freetype source directory -- be patient)
@ -621,20 +666,24 @@ dnl and not all libintls have that. So check for it instead.
dnl sometimes it lives in libc so we can't dlopen it
gww_has_gettext="yes"
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE( _STATIC_LIBINTL ) , [
AC_CHECK_LIB(intl, bind_textdomain_codeset,: ,gww_has_gettext="no" )])
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE(_STATIC_LIBINTL) , [
AC_CHECK_LIB(intl, bind_textdomain_codeset,LIBS="$LIBS -lintl" ,gww_has_gettext="no" )])
if test $gww_has_gettext = yes >/dev/null ; then
AC_CHECK_HEADERS([libintl.h], : , gww_has_gettext="no")
fi
gww_regular_link="no"
AC_ARG_WITH(regular-link,
[ --with-regular-link Don't try to dlopen libraries],
AS_HELP_STRING([--with-regular-link],[Don't try to dlopen libraries]),
[
if test "$withval" != "no" >/dev/null 2>&1 ; then
gww_regular_link="yes"
AC_DEFINE(NODYNAMIC)
gww_rpath=""
if test "$gww_extraincludes" != "" ; then
CPPFLAGS=`echo $CPPFLAGS | sed -e "s%-idirafter $gww_extraincludes%%"`
CPPFLAGS="$CPPFLAGS -I$gww_extraincludes"
fi
fi
], : )
@ -659,6 +708,9 @@ if test "$gww_nodynamic" = "yes" -o "$gww_regular_link" = "yes"; then
if test "$ac_cv_lib_png12_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng12 -lz"
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng14 -lz"
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -ltiff"
fi
@ -711,6 +763,10 @@ if test "$gww_needsstaticimages" = "yes" -a "$gww_regular_link" = "no"; then
STATIC_LIBS="$STATIC_LIBS -lpng12 -lz"
AC_DEFINE(_STATIC_LIBPNG)
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -lpng14 -lz"
AC_DEFINE(_STATIC_LIBPNG)
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
STATIC_LIBS="$STATIC_LIBS -ltiff"
AC_DEFINE(_STATIC_LIBTIFF)
@ -750,6 +806,9 @@ case "$host" in
if test "$ac_cv_lib_png12_png_create_read_struct" = "yes"; then
AC_CHECK_LIB_LA(png12, :, [ STATIC_LIBS="$STATIC_LIBS -lpng12 -lz" ; AC_DEFINE(_STATIC_LIBPNG12)])
fi
if test "$ac_cv_lib_png14_png_create_read_struct" = "yes"; then
AC_CHECK_LIB_LA(png14, :, [ STATIC_LIBS="$STATIC_LIBS -lpng14 -lz" ; AC_DEFINE(_STATIC_LIBPNG14)])
fi
if test "$ac_cv_lib_tiff_TIFFOpen" = "yes"; then
AC_CHECK_LIB_LA(tiff, :, [ STATIC_LIBS="$STATIC_LIBS -ltiff" ; AC_DEFINE(_STATIC_LIBTIFF)])
fi
@ -781,14 +840,14 @@ esac
fi
AC_ARG_ENABLE(type3,
[ --enable-type3 Control whether we build with support for type3/svg fonts containing multilayered drawing with strokes, fills, images, etc.],
AS_HELP_STRING([--enable-type3],[Control whether we build with support for type3/SVG fonts containing multilayered drawing with strokes, fills, images, etc.]),
[
if test "$enableval" != "no" >/dev/null 2>&1 ; then
AC_DEFINE(FONTFORGE_CONFIG_TYPE3)
fi
], : )
AC_ARG_ENABLE(multilayer,
[ --enable-multilayer Control whether we build with support for type3/svg fonts containing multilayered drawing with strokes, fills, images, etc. (deprecated. Use --enable-type3 instead)],
AS_HELP_STRING([--enable-multilayer],[Control whether we build with support for type3/SVG fonts containing multilayered drawing with strokes, fills, images, etc. (deprecated. Use --enable-type3 instead)]),
[
if test "$enableval" != "no" >/dev/null 2>&1 ; then
AC_DEFINE(FONTFORGE_CONFIG_TYPE3)
@ -859,6 +918,12 @@ dnl a pity.
dnl Build a $ac_confdir/po/Makefile.in with appropriate instructions for installing all locales
MACKEYS=
if ! msgfmt --help >/dev/null 2>&1 ; then
dnl even if the library is installed, the executables might not be. Or might
dnl not be in the PATH.
gww_has_gettext="no";
fi
if test "$gww_has_gettext" = "yes" >/dev/null 2>&1 ; then
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
mofiles="$(cd $ac_confdir/po/mackeys && ls *.po | sed -e 's#\.po#\.mo#g')"
@ -943,9 +1008,11 @@ fi
PY=
if test "$gww_dopy" = "yes" >/dev/null 2>&1 ; then
AC_SUBST(PYINCLUDE)
AC_SUBST(PYPREFIX)
AC_SUBST(PYDEFINES)
AC_SUBST(PYLIBS)
PYINCLUDE=
PYPREFIX="$real_prefix"
PYDEFINES="('PREFIX','\"$real_prefix\"')"
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
PYDEFINES="$PYDEFINES, ('__Mac','1')"
@ -965,6 +1032,12 @@ if test -e gtkui/Makefile.in -a \( -e /usr/include/gtk-2.0/gtk/gtk.h -o -e /sw/i
GTFF=gtkui/Makefile
fi
if test "$gww_archlist" != "" ; then
CFLAGS="$CFLAGS $gww_archlist"
LDFLAGS="$LDFLAGS $gww_archlist"
fi
AC_SUBST(CFLAGS_NOOPT)
CFLAGS_NOOPT=`echo $CFLAGS | sed -e s/-O.//g | sed -e s/-O//g`
cp $ac_confdir/Makefile.dynamic.in $ac_confdir/Makefile.in
cp $ac_confdir/Unicode/Makefile.dynamic.in $ac_confdir/Unicode/Makefile.in

View File

@ -576,7 +576,7 @@ PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="fontforge/pfaedit.h"
ac_unique_file="fontforge/fontforge.h"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@ -1276,8 +1276,6 @@ if test -n "$ac_init_help"; then
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-shared[=PKGS] build shared libraries [default=no]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-debug-raw-points Add a raw mode to the points window of the debugger
--disable-macapp Do not build a mac Application (only for macs)
--enable-type3 Control whether we build with support for type3/svg
@ -2779,54 +2777,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then
enableval=$enable_shared; p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
enable_shared=no
fi
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then
enableval=$enable_static; p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
enable_static=yes
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
@ -3390,7 +3340,7 @@ _ACEOF
eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
done
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
for ac_extension in a so sl dylib la dll; do
if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
test -f "$ac_im_libdir/libX11.$ac_extension"; then
ac_im_usrlibdir=$ac_im_libdir; break
@ -3543,7 +3493,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
for ac_extension in a so sl dylib la dll; do
if test -r "$ac_dir/libX11.$ac_extension"; then
ac_x_libraries=$ac_dir
break 2
@ -5123,7 +5073,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
rm -f conftest*
rm -f -r conftest*
fi
@ -5144,7 +5094,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
else
ac_cv_header_stdc=no
fi
rm -f conftest*
rm -f -r conftest*
fi
@ -5750,7 +5700,91 @@ if test "$ac_res" != no; then
fi
if test "$gww_uselessiconv" = "no" ; then
{ echo "$as_me:$LINENO: checking for library containing libiconv" >&5
# on some systems "iconv()" lives in libc. On others it lives in libiconv
# on older systems "libiconv()" lives in libiconv
{ echo "$as_me:$LINENO: checking for library containing iconv" >&5
echo $ECHO_N "checking for library containing iconv... $ECHO_C" >&6; }
if test "${ac_cv_search_iconv+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_func_search_save_LIBS=$LIBS
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char iconv ();
int
main ()
{
return iconv ();
;
return 0;
}
_ACEOF
for ac_lib in '' iconv; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_search_iconv=$ac_res
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext
if test "${ac_cv_search_iconv+set}" = set; then
break
fi
done
if test "${ac_cv_search_iconv+set}" = set; then
:
else
ac_cv_search_iconv=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_search_iconv" >&5
echo "${ECHO_T}$ac_cv_search_iconv" >&6; }
ac_res=$ac_cv_search_iconv
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
{ echo "$as_me:$LINENO: checking for library containing libiconv" >&5
echo $ECHO_N "checking for library containing libiconv... $ECHO_C" >&6; }
if test "${ac_cv_search_libiconv+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -5831,8 +5865,13 @@ ac_res=$ac_cv_search_libiconv
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
gww_uselessiconv="yes"
fi
fi
fi
fi
python="yes"
@ -5852,7 +5891,7 @@ if test "$python" = "yes" ; then
if python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" >/dev/null 2>&1 ; then
if python -c "import distutils.sysconfig ; print '%s/%s %s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'),distutils.sysconfig.get_config_var('LIBS'))" >/dev/null 2>&1 ; then
PyVersion=`python -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')"`
PySubVersion=`echo $PyVersion |sed -e 's/2.//'`
PySubVersion=`echo $PyVersion |sed -e 's/2\.//' -e 's/3\.//'`
PyInc=`python -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('INCLUDEPY')"`
PyLib=`python -c "import distutils.sysconfig ; print '%s/%s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'))"`
if test "$PySubVersion" \!= "" -a "$PySubVersion" -le 2 ; then
@ -6840,13 +6879,13 @@ _ACEOF
fi
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng... $ECHO_C" >&6; }
if test "${ac_cv_lib_png_png_create_read_struct+set}" = set; then
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng16" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng16... $ECHO_C" >&6; }
if test "${ac_cv_lib_png16_png_create_read_struct+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng -lz -lm $LIBS"
LIBS="-lpng16 -lz -lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -6887,25 +6926,164 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_png_png_create_read_struct=yes
ac_cv_lib_png16_png_create_read_struct=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_png_png_create_read_struct=no
ac_cv_lib_png16_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_create_read_struct" >&5
echo "${ECHO_T}$ac_cv_lib_png_png_create_read_struct" >&6; }
if test $ac_cv_lib_png_png_create_read_struct = yes; then
:
{ echo "$as_me:$LINENO: result: $ac_cv_lib_png16_png_create_read_struct" >&5
echo "${ECHO_T}$ac_cv_lib_png16_png_create_read_struct" >&6; }
if test $ac_cv_lib_png16_png_create_read_struct = yes; then
cat >>confdefs.h <<\_ACEOF
#define _LIBPNG16 1
_ACEOF
else
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng12" >&5
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng15" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng15... $ECHO_C" >&6; }
if test "${ac_cv_lib_png15_png_create_read_struct+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng15 -lz -lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_create_read_struct ();
int
main ()
{
return png_create_read_struct ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_png15_png_create_read_struct=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_png15_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_png15_png_create_read_struct" >&5
echo "${ECHO_T}$ac_cv_lib_png15_png_create_read_struct" >&6; }
if test $ac_cv_lib_png15_png_create_read_struct = yes; then
cat >>confdefs.h <<\_ACEOF
#define _LIBPNG15 1
_ACEOF
else
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng14" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng14... $ECHO_C" >&6; }
if test "${ac_cv_lib_png14_png_create_read_struct+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng14 -lz -lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_create_read_struct ();
int
main ()
{
return png_create_read_struct ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_png14_png_create_read_struct=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_png14_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_png14_png_create_read_struct" >&5
echo "${ECHO_T}$ac_cv_lib_png14_png_create_read_struct" >&6; }
if test $ac_cv_lib_png14_png_create_read_struct = yes; then
cat >>confdefs.h <<\_ACEOF
#define _LIBPNG14 1
_ACEOF
else
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng12" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng12... $ECHO_C" >&6; }
if test "${ac_cv_lib_png12_png_create_read_struct+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -6971,6 +7149,71 @@ if test $ac_cv_lib_png12_png_create_read_struct = yes; then
#define _LIBPNG12 1
_ACEOF
else
{ echo "$as_me:$LINENO: checking for png_create_read_struct in -lpng" >&5
echo $ECHO_N "checking for png_create_read_struct in -lpng... $ECHO_C" >&6; }
if test "${ac_cv_lib_png_png_create_read_struct+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng -lz -lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_create_read_struct ();
int
main ()
{
return png_create_read_struct ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_png_png_create_read_struct=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_png_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_create_read_struct" >&5
echo "${ECHO_T}$ac_cv_lib_png_png_create_read_struct" >&6; }
if test $ac_cv_lib_png_png_create_read_struct = yes; then
:
else
cat >>confdefs.h <<\_ACEOF
#define _NO_LIBPNG 1
@ -6980,6 +7223,12 @@ fi
fi
fi
fi
fi
if test "${ac_cv_header_png_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for png.h" >&5
echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
@ -9442,7 +9691,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
cat >>confdefs.h <<\_ACEOF
#define _STATIC_LIBINTL 1
#define _STATIC_LIBINTL 1
_ACEOF
else
@ -9799,6 +10048,10 @@ test -d libs || mkdir libs
MACKEYS=
if ! msgfmt --help >/dev/null 2>&1 ; then
gww_has_gettext="no";
fi
if test "$gww_has_gettext" = "yes" >/dev/null 2>&1 ; then
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
mofiles="$(cd $ac_confdir/po/mackeys && ls *.po | sed -e 's#\.po#\.mo#g')"

View File

@ -1,10 +1,11 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(fontforge/pfaedit.h)
AC_INIT(fontforge/fontforge.h)
AC_PROG_CC
AC_PROG_INSTALL
AC_DISABLE_SHARED
AC_ENABLE_STATIC
dnl AC_DISABLE_SHARED
dnl AC_ENABLE_STATIC
AC_PROG_RANLIB
AC_CANONICAL_HOST
@ -131,7 +132,10 @@ AC_SUBST(FF_EXTRA_FILES)
AC_SEARCH_LIBS(dlopen, dl) dnl some systems have this in libc
AC_SEARCH_LIBS(inet_aton, resolv) dnl some systems have this in libc
if test "$gww_uselessiconv" = "no" ; then
AC_SEARCH_LIBS(libiconv, iconv) dnl linux has iconv in libc, mac,solaris have libiconv in libiconv, and a define to map iconv() to libiconv(), so we can't do the obvious check
# on some systems "iconv()" lives in libc. On others it lives in libiconv
# on older systems "libiconv()" lives in libiconv
AC_SEARCH_LIBS(iconv, iconv,,
AC_SEARCH_LIBS(libiconv, iconv,,gww_uselessiconv="yes"))
fi
python="yes"
@ -147,7 +151,7 @@ if test "$python" = "yes" ; then
if python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" >/dev/null 2>&1 ; then
if python -c "import distutils.sysconfig ; print '%s/%s %s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'),distutils.sysconfig.get_config_var('LIBS'))" >/dev/null 2>&1 ; then
PyVersion=`python -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('VERSION')"`
PySubVersion=`echo $PyVersion |sed -e 's/2.//'`
PySubVersion=`echo $PyVersion |sed -e 's/2\.//' -e 's/3\.//'`
PyInc=`python -c "import distutils.sysconfig ; print '%s' % distutils.sysconfig.get_config_var('INCLUDEPY')"`
PyLib=`python -c "import distutils.sysconfig ; print '%s/%s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'))"`
if test "$PySubVersion" \!= "" -a "$PySubVersion" -le 2 ; then
@ -247,8 +251,12 @@ AC_TRY_COMPILE([#include <gif_lib.h>], [ ExtensionBlock foo; foo.Function=3; ],
] , AC_DEFINE(_NO_LIBUNGIF))])
AC_CHECK_LIB(z, deflateEnd, : ,AC_DEFINE(_NO_LIBPNG), -lm)
AC_CHECK_LIB(png, png_create_read_struct, : ,[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12), AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)
AC_CHECK_LIB(png16, png_create_read_struct, AC_DEFINE(_LIBPNG16),[
AC_CHECK_LIB(png15, png_create_read_struct, AC_DEFINE(_LIBPNG15),[
AC_CHECK_LIB(png14, png_create_read_struct, AC_DEFINE(_LIBPNG14),[
AC_CHECK_LIB(png12, png_create_read_struct, AC_DEFINE(_LIBPNG12),[
AC_CHECK_LIB(png, png_create_read_struct, : ,
AC_DEFINE(_NO_LIBPNG), -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)], -lz -lm)
AC_CHECK_HEADER(png.h, : , AC_DEFINE(_NO_LIBPNG))
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, : ,AC_DEFINE(_NO_LIBJPEG))
AC_CHECK_HEADER(jpeglib.h, : , AC_DEFINE(_NO_LIBJPEG))
@ -472,7 +480,7 @@ dnl mac's don't have gettext, people have to use fink to install it
gww_has_gettext="yes"
AC_CHECK_HEADERS([libintl.h], : , gww_has_gettext="no")
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE( _STATIC_LIBINTL ) , [
AC_LINK_IFELSE([AC_LANG_CALL([],[bind_textdomain_codeset])], AC_DEFINE(_STATIC_LIBINTL) , [
AC_CHECK_LIB(intl, bind_textdomain_codeset,: ,HAVE_LIBINTL_H=0 )])
dnl If we can't/don't want to use dynamic libraries then we must link with
@ -600,6 +608,12 @@ test -d libs || mkdir libs
dnl Build a $ac_confdir/po/Makefile.in with appropriate instructions for installing all locales
MACKEYS=
if ! msgfmt --help >/dev/null 2>&1 ; then
dnl even if the library is installed, the executables might not be. Or might
dnl not be in the PATH.
gww_has_gettext="no";
fi
if test "$gww_has_gettext" = "yes" >/dev/null 2>&1 ; then
if test "$gww_ismac" = "yes" >/dev/null 2>&1 ; then
mofiles="$(cd $ac_confdir/po/mackeys && ls *.po | sed -e 's#\.po#\.mo#g')"

View File

@ -1,7 +1,8 @@
# Makefile for OpenVMS
# Date : 11 November 2008
# Date : 16 February 2011
all :
if f$search("libs.dir") .eqs. "" then create/directory [.libs]
set def [.inc]
mms
set def [-.unicode]

Binary file not shown.

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
@ -28,7 +30,7 @@ FF_AGE=0
fontforge_LIBOBJECTS = asmfpst.$O autohint.$O autosave.$O autotrace.$O autowidth.$O \
bezctx_ff.$O bitmapchar.$O bitmapcontrol.$O bvedit.$O clipnoui.$O crctab.$O \
cvexport.$O cvimages.$O cvundoes.$O dumpbdf.$O dumppfa.$O effects.$O encoding.$O \
featurefile.$O fontviewbase.$O freetype.$O fvcomposit.$O fvfonts.$O fvimportbdf.$O \
featurefile.$O fontviewbase.$O freetype.$O fvcomposite.$O fvfonts.$O fvimportbdf.$O \
fvmetrics.$O glyphcomp.$O http.$O ikarus.$O lookups.$O macbinary.$O \
macenc.$O mathconstants.$O mm.$O namelist.$O nonlineartrans.$O noprefs.$O nouiutil.$O \
nowakowskittfinstr.$O ofl.$O othersubrs.$O palmfonts.$O parsepdf.$O parsepfa.$O \
@ -39,8 +41,9 @@ fontforge_LIBOBJECTS = asmfpst.$O autohint.$O autosave.$O autotrace.$O autowidth
splinesaveafm.$O splinesave.$O splinestroke.$O splineutil2.$O splineutil.$O \
start.$O stemdb.$O svg.$O tottfaat.$O tottfgpos.$O tottf.$O \
tottfvar.$O ttfinstrs.$O ttfspecial.$O ufo.$O unicoderange.$O utils.$O \
winfonts.$O zapfnomen.$O groups.$O langfreq.$O
fontforge_UIOBJECTS = alignment.o anchorsaway.o autowidthdlg.o basedlg.o \
winfonts.$O zapfnomen.$O groups.$O langfreq.$O ftdelta.$O autowidth2.$O \
woff.$O
fontforge_UIOBJECTS1 = alignment.o anchorsaway.o autowidth2dlg.o basedlg.o \
bdfinfo.o bitmapdlg.o bitmapview.o charinfo.o charview.o clipui.o \
combinations.o contextchain.o cursors.o cvaddpoints.o cvdebug.o cvdgloss.o \
cvexportdlg.o cvfreehand.o cvgetinfo.o cvgridfit.o cvhand.o cvhints.o \
@ -52,8 +55,9 @@ fontforge_UIOBJECTS = alignment.o anchorsaway.o autowidthdlg.o basedlg.o \
macencui.o math.o metricsview.o mmdlg.o nonlineartransui.o oflib.o \
openfontdlg.o prefs.o problems.o pythonui.o savefontdlg.o scriptingdlg.o \
scstylesui.o searchview.o sftextfield.o showatt.o simplifydlg.o splashimage.o \
stamp.o startui.o statemachine.o tilepath.o transform.o ttfinstrsui.o \
uiutil.o windowmenu.o
startui.o statemachine.o tilepath.o transform.o ttfinstrsui.o \
uiutil.o windowmenu.o justifydlg.o deltaui.o
fontforge_UIOBJECTS = $(fontforge_UIOBJECTS1) stamp.o
fontforge_SCRIPTOBJ = startnoui.o stamp.o
DIFFOBJS = sfddiff.o stamp.o
@ -65,8 +69,8 @@ _CFLAGS = -I$(top_srcdir)/inc -I../inc -I$(srcdir) -I. @WFLAGS@ $(X_CFLAGS) \
CFLAGS = @CFLAGS@ @CPPFLAGS@ $(_CFLAGS)
#I used to include -L/usr/lib explicitly after static_libs. Not sure why. Should be implied & breaks 64bit compiles
LDFLAGS = @LDFLAGS@
LIBS = -rpath $(libdir) $(X_LIBS) @LINK_WITH_GDRAW@ ../libgutils.la \
LDFLAGS = $(X_LIBS) @LDFLAGS@
LIBS = -rpath $(libdir) @LINK_WITH_GDRAW@ ../libgutils.la \
../libgunicode.la \
$(X_PRE_LIBS) $(X_11LIB) $(X_EXTRA_LIBS) @LIBS@ $(STATIC_LIBS) -lm
LIBLIBS = -rpath $(libdir) ../libgutils.la ../libgunicode.la \
@ -86,7 +90,7 @@ fontforge: $(@exeOBJECTS@) $(fontforge_LIBOBJECTS) exelibstamp.pre libstamp.pre
../libfontforge.la: $(@exeOBJECTS@) $(fontforge_LIBOBJECTS) exelibstamp.pre libstamp.pre
sed -e '1,$$ s/REPLACE_ME_WITH_MAJOR_VERSION/$(FF_VERSION)/' -e '1,$$ s/REPLACE_ME_WITH_MINOR_VERSION/$(FF_REVISION)/' < libstamp.pre > libstamp.c
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c libstamp.c
$(LIBTOOL) --mode=link $(CC) -no-undefined $(CFLAGS) @LDFLAGS@ \
$(LIBTOOL) --mode=link $(CC) -no-undefined $(CFLAGS) $(LDFLAGS) \
-o ../libfontforge.la $(fontforge_LIBOBJECTS) libstamp.lo $(LIBLIBS) \
-rpath $(libdir) -version-info $(FF_VERSION):$(FF_REVISION):$(FF_AGE)
sed -e '1,$$ s/REPLACE_ME_WITH_MAJOR_VERSION/$(FF_VERSION)/' -e '1,$$ s/REPLACE_ME_WITH_MINOR_VERSION/$(FF_REVISION)/' < exelibstamp.pre > exelibstamp.c
@ -126,10 +130,10 @@ acorn2sfd: $(ACORNOBJS)
# disasterous effects. This file may not be compiled with the optimizer.
# On the other hand we do need CPPFLAGS to get the right includes...
splinerefigure.o: $(srcdir)/splinerefigure.c $(srcdir)/splinefont.h
$(CC) -g -c -o splinerefigure.o $(_CFLAGS) $(srcdir)/splinerefigure.c
$(CC) -g -c -o splinerefigure.o @CFLAGS_NOOPT@ $(_CFLAGS) $(srcdir)/splinerefigure.c
splinerefigure.lo: $(srcdir)/splinerefigure.c $(srcdir)/splinefont.h
$(LIBTOOL) --mode=compile $(CC) -g -c -o splinerefigure.lo $(_CFLAGS) $(srcdir)/splinerefigure.c
$(LIBTOOL) --mode=compile $(CC) -g -c -o splinerefigure.lo @CFLAGS_NOOPT@ $(_CFLAGS) $(srcdir)/splinerefigure.c
%.o: %.c
@ -177,3 +181,10 @@ FontForge-old.pot: *.c utf8.pot
xgettext -k_ -kN_ -kS_ -kP_:1,2 --add-comments=GT: -oFontForge.pot *.c ../gdraw/*.c
cat utf8.pot >> FontForge.pot
-patch < pottitle.patch
# Apply these before doing a release
#stamp.c: stamper $(fontforge_UIOBJECTS1) $(fontforge_LIBOBJECTS)
#libffstamp.h: stamper $(fontforge_LIBOBJECTS)
stamps: stamper
./stamper > stamp.c
./stamper -l >libffstamp.h

View File

@ -1,3 +1,5 @@
SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
@ -20,7 +22,7 @@ STATIC_LIBS = @STATIC_LIBS@
fontforge_LIBOBJECTS = asmfpst.o autohint.o autosave.o autotrace.o autowidth.o \
bezctx_ff.o bitmapchar.o bitmapcontrol.o bvedit.o clipnoui.o crctab.o \
cvexport.o cvimages.o cvundoes.o dumpbdf.o dumppfa.o effects.o encoding.o \
featurefile.o fontviewbase.o freetype.o fvcomposit.o fvfonts.o fvimportbdf.o \
featurefile.o fontviewbase.o freetype.o fvcomposite.o fvfonts.o fvimportbdf.o \
fvmetrics.o glyphcomp.o http.o ikarus.o lookups.o macbinary.o \
macenc.o mathconstants.o mm.o namelist.o nonlineartrans.o noprefs.o nouiutil.o \
nowakowskittfinstr.o ofl.o othersubrs.o palmfonts.o parsepdf.o parsepfa.o \
@ -31,8 +33,9 @@ fontforge_LIBOBJECTS = asmfpst.o autohint.o autosave.o autotrace.o autowidth.o \
splinesaveafm.o splinesave.o splinestroke.o splineutil2.o splineutil.o \
start.o stemdb.o svg.o tottfaat.o tottfgpos.o tottf.o \
tottfvar.o ttfinstrs.o ttfspecial.o ufo.o unicoderange.o utils.o \
winfonts.o zapfnomen.o groups.o langfreq.o
fontforge_UIOBJECTS = alignment.o anchorsaway.o autowidthdlg.o basedlg.o \
winfonts.o zapfnomen.o groups.o langfreq.o ftdelta.o autowidth2.o \
woff.o
fontforge_UIOBJECTS = alignment.o anchorsaway.o basedlg.o \
bdfinfo.o bitmapdlg.o bitmapview.o charinfo.o charview.o clipui.o \
combinations.o contextchain.o cursors.o cvaddpoints.o cvdebug.o cvdgloss.o \
cvexportdlg.o cvfreehand.o cvgetinfo.o cvgridfit.o cvhand.o cvhints.o \
@ -45,7 +48,7 @@ fontforge_UIOBJECTS = alignment.o anchorsaway.o autowidthdlg.o basedlg.o \
openfontdlg.o prefs.o problems.o pythonui.o savefontdlg.o scriptingdlg.o \
scstylesui.o searchview.o sftextfield.o showatt.o simplifydlg.o splashimage.o \
startui.o stamp.o statemachine.o tilepath.o transform.o ttfinstrsui.o \
uiutil.o windowmenu.o
uiutil.o windowmenu.o justifydlg.o deltaui.o autowidth2dlg.o
fontforge_SCRIPTOBJ = startnoui.o stamp.o
fontforge_OBJECTS=$(fontforge_LIBOBJECTS) $(@exeOBJECTS@)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008 by George Williams */
/* Copyright (C) 2008-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -396,7 +396,7 @@ return( false );
pattern = ppt;
++name;
} else if ( ch=='{' ) {
/* matches any of a comma seperated list of substrings */
/* matches any of a comma separated list of substrings */
for ( ppt = pattern+1; *ppt!='\0' ; ppt = ept ) {
for ( ept=ppt; *ept!='}' && *ept!=',' && *ept!='\0'; ++ept );
for ( npt = name; ppt<ept; ++npt, ++ppt ) {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include "splinefont.h"
#include "ustring.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005-2008 by George Williams */
/* Copyright (C) 2005-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <gkeysym.h>
#include <string.h>
#include <ustring.h>

View File

@ -1,4 +1,3 @@
/* Copyright (C) 2003-2007 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
@ -84,13 +83,12 @@ return( NULL );
for ( j=0; j<3; ++j ) {
cnt = 0;
if ( (&fpst->rules[i].u.glyph.names)[j]!=NULL && *(&fpst->rules[i].u.glyph.names)[j]!='\0' ) {
cnt = 1;
for ( pt=(&fpst->rules[i].u.glyph.names)[j]; *pt; ++pt ) {
if ( *pt==' ' ) {
++cnt;
while ( *pt==' ' ) ++pt;
--pt;
}
for ( pt=(&fpst->rules[i].u.glyph.names)[j]; *pt; ) {
while ( *pt==' ' ) ++pt;
if ( *pt=='\0' )
break;
while ( *pt!=' ' && *pt!='\0' ) ++pt;
++cnt;
}
}
(&new->rules[i].u.class.ncnt)[j] = cnt;
@ -123,12 +121,15 @@ return( NULL );
}
new->nccnt = nextclass;
new->nclass = names;
new->nclassnames = gcalloc(nextclass,sizeof(char *)); /* Leave as NULL */
if ( fpst->type==pst_chainpos || fpst->type==pst_chainsub ) {
/* our class set has one "class" for each glyph used anywhere */
/* all three class sets are the same */
new->bccnt = new->fccnt = nextclass;
new->bclass = classcopy(names,nextclass);
new->fclass = classcopy(names,nextclass);
new->bclassnames = gcalloc(nextclass,sizeof(char *)); /* Leave as NULL */
new->fclassnames = gcalloc(nextclass,sizeof(char *)); /* Leave as NULL */
}
return( new );
}
@ -694,7 +695,7 @@ return( NULL );
next = gcalloc(1<<match_len,sizeof(int));
temp = galloc((1<<match_len)*sizeof(SplineChar **));
for ( i=0; i<gtot; ++i ) if ( sf->glyphs[i]!=NULL ) {
for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) {
sf->glyphs[i]->lsidebearing = 0;
sf->glyphs[i]->ticked = false;
}
@ -1003,6 +1004,7 @@ ASM *ASMFromFPST(SplineFont *sf,FPST *fpst,int ordered) {
}
/* This is a temporary value. It should be replaced if we plan to */
/* retain this state machine */
sm->subtable = fpst->subtable;
if ( sm!=NULL )
sm->subtable = fpst->subtable;
return( sm );
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaedit.h"
#include "fontforge.h"
#include <stdio.h>
#include <math.h>
#include "splinefont.h"
@ -86,7 +86,7 @@ void FindBlues( SplineFont *sf, int layer, real blues[14], real otherblues[10])
DBounds b;
/* Go through once to get some idea of the average value so we can weed */
/* out undesireables */
/* out undesirables */
caph[0] = caph[1] = caph[2] = xh[0] = xh[1] = xh[2] = 0;
ascenth[0] = ascenth[1] = ascenth[2] = digith[0] = digith[1] = digith[2] = 0;
descenth[0] = descenth[1] = descenth[2] = base[0] = base[1] = base[2] = 0;
@ -1245,7 +1245,7 @@ int StemListAnyConflicts(StemInfo *stems) {
s->hasconflicts = false;
while ( stems!=NULL ) {
end = stems->width<0 ? stems->start : stems->start+stems->width;
for ( s=stems->next; s!=NULL && (s->width>0 ? s->start : s->start+s->width)<end; s=s->next ) {
for ( s=stems->next; s!=NULL && (s->width>0 ? s->start : s->start+s->width)<=end; s=s->next ) {
stems->hasconflicts = true;
s->hasconflicts = true;
any = true;
@ -1587,8 +1587,8 @@ void SCGuessHintInstancesList( SplineChar *sc,int layer,StemInfo *hstem,StemInfo
if ( hstem == NULL && vstem == NULL && dstem == NULL )
return;
/* If all stems already have active zones assigned (actual for .sfd
/* files), then there is no need to wast time generating glyph data for
/* If all stems already have active zones assigned (actual for .sfd */
/* files), then there is no need to wast time generating glyph data for */
/* this glyph */
test = hstem;
while ( !hneeds_gd && test != NULL ) {
@ -1747,10 +1747,10 @@ return( true );
prev = cur; cur = dn;
/* Compare the given stem with each of the existing diagonal stem
/* hints. First ensure that it is not an exact duplicate of an already
/* added stem. Then test if unit vectors are parallel and edges colinear.
/* In this case we should either preserve the existing stem or replace
/* it with the new one, but not keep them both */
* hints. First ensure that it is not an exact duplicate of an already
* added stem. Then test if unit vectors are parallel and edges colinear.
* In this case we should either preserve the existing stem or replace
* it with the new one, but not keep them both */
if (test->unit.x == dn->unit.x && test->unit.y == dn->unit.y &&
test->left.x == dn->left.x && test->left.y == dn->left.y &&
test->right.x == dn->right.x && test->right.y == dn->right.y ) {
@ -1785,7 +1785,7 @@ return( false );
}
} else
overlap = true;
/* It's probably a colinear dstem, as in older SFD files. Treat
/* It's probably a colinear dstem, as in older SFD files. Treat */
/* it as one more instance for the already added stem */
if ( !overlap ) {
for ( hi=dn->where; hi->next != NULL; hi = hi->next ) ;
@ -1793,8 +1793,8 @@ return( false );
hi->next->begin = ibegin; hi->next->end = iend;
DStemInfoFree( test );
return( false );
/* The found stem is close but not identical to the stem we
/* are going to add. So just replace the older stem with the
/* The found stem is close but not identical to the stem we */
/* are going to add. So just replace the older stem with the */
/* new one */
} else {
test->next = dn->next;
@ -1808,10 +1808,10 @@ return( true );
}
/* Insert the given stem to the list by such a way that diagonal
/* stems are ordered by the X coordinate of the left edge key point, and
/* by Y if X is the same. The order is arbitrary, but may be essential for
/* things like "W". So we should be sure that the autoinstructor will
/* process diagonals from left to right. */
* stems are ordered by the X coordinate of the left edge key point, and
* by Y if X is the same. The order is arbitrary, but may be essential for
* things like "W". So we should be sure that the autoinstructor will
* process diagonals from left to right. */
base = ( test->unit.y < 0 ) ? &test->right : &test->left;
nbase = ( (*ds)->unit.y < 0 ) ? &(*ds)->right : &(*ds)->left;
@ -2278,7 +2278,7 @@ return( possible );
/* Does h have a conflict with any of the stems in the list which have bits */
/* set in the mask */
static int ConflictsWithMask(StemInfo *stems, HintMask mask,StemInfo *h) {
while ( stems!=NULL && stems->start<h->start+h->width ) {
while ( stems!=NULL && stems->start<=h->start+h->width ) {
if ( stems->start+stems->width>=h->start && stems!=h ) {
if ( stems->hintnumber!=-1 &&
(mask[stems->hintnumber>>3]&(0x80>>(stems->hintnumber&7))) )
@ -2882,12 +2882,12 @@ static DStemInfo *GDFindDStems(struct glyphdata *gd) {
for ( i=0; i<gd->stemcnt; ++i ) {
stem = &gd->stems[i];
/* A real diagonal stem should consist of one or more continuous
/* ranges. Thus the number of active zones should be less then the
/* number of stem chunks (i. e. pairs of the opposite points). If
/* each chunk has its own active zone, then we probably have got
/* not a real stem, but rather two (or more) separate point pairs,
/* which occasionally happened to have nearly the same vectors and
/* to be positioned on the same lines */
* ranges. Thus the number of active zones should be less then the
* number of stem chunks (i. e. pairs of the opposite points). If
* each chunk has its own active zone, then we probably have got
* not a real stem, but rather two (or more) separate point pairs,
* which occasionally happened to have nearly the same vectors and
* to be positioned on the same lines */
if ( stem->toobig )
continue;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -34,30 +34,14 @@
#include <stdlib.h>
#include <dirent.h>
#include <ustring.h>
#include "gfile.h"
int AutoSaveFrequency=30;
#if !defined(__MINGW32__)
# include <pwd.h>
#endif
static char *gethomedir(void) {
static char *dir;
int uid;
struct passwd *pw;
dir = getenv("HOME");
if ( dir!=NULL )
return( copy(dir) );
uid = getuid();
while ( (pw=getpwent())!=NULL ) {
if ( pw->pw_uid==uid ) {
dir = copy(pw->pw_dir);
endpwent();
return( dir );
}
}
endpwent();
return( NULL );
}
char *getPfaEditDir(char *buffer) {
static char *editdir = NULL;
@ -67,21 +51,29 @@ char *getPfaEditDir(char *buffer) {
if ( editdir!=NULL )
return( editdir );
dir=gethomedir();
dir = GFileGetHomeDir();
if ( dir==NULL )
return( NULL );
sprintf(buffer,"%s/.FontForge", dir);
/* We used to use .PfaEdit. So if we don't find a .FontForge look for that*/
#ifdef __VMS
sprintf(buffer,"%s/_FontForge", dir);
#else
sprintf(buffer,"%s/.FontForge", dir);
#endif
/* We used to use .PfaEdit. So if we don't find a .FontForge look for that*/
/* if there is a .PfaEdit, then rename it to .FontForge */
if ( access(buffer,F_OK)==-1 ) {
snprintf(olddir,sizeof(olddir),"%s/.PfaEdit", dir);
if ( access(olddir,F_OK)==0 )
#ifdef __VMS
snprintf(olddir,sizeof(olddir),"%s/_PfaEdit", dir);
#else
snprintf(olddir,sizeof(olddir),"%s/.PfaEdit", dir);
#endif
if ( access(olddir,F_OK)==0 )
rename(olddir,buffer);
}
free(dir);
/* If we still can't find it, create it */
if ( access(buffer,F_OK)==-1 )
if ( mkdir(buffer,0700)==-1 )
if ( GFileMkDir(buffer)==-1 )
return( NULL );
editdir = copy(buffer);
return( editdir );
@ -94,7 +86,7 @@ static char *getAutoDirName(char *buffer) {
return( NULL );
sprintf(buffer,"%s/autosave", dir);
if ( access(buffer,F_OK)==-1 )
if ( mkdir(buffer,0700)==-1 )
if ( GFileMkDir(buffer)==-1 )
return( NULL );
dir = copy(buffer);
return( dir );
@ -174,6 +166,9 @@ void _DoAutoSaves(FontViewBase *fvs) {
FontViewBase *fv;
SplineFont *sf;
if ( AutoSaveFrequency<=0 )
return;
for ( fv=fvs; fv!=NULL; fv=fv->next ) {
sf = fv->cidmaster?fv->cidmaster:fv->sf;
if ( sf->changed_since_autosave ) {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -29,9 +29,12 @@
#include <ustring.h>
#include <utype.h>
#include "sd.h"
#include "gfile.h"
#include <sys/types.h> /* for waitpid */
#if !defined(__MINGW32__)
#include <sys/wait.h> /* for waitpid */
#endif
#include <unistd.h> /* for access, unlink, fork, execvp, getcwd */
#include <sys/stat.h> /* for open */
#include <fcntl.h> /* for open */
@ -87,7 +90,7 @@ static SplinePointList *localSplinesFromEntities(Entity *ent, Color bgcol, int i
si.radius = ent->u.splines.stroke_width/2;
new = NULL;
for ( test = ent->u.splines.splines; test!=NULL; test=test->next ) {
temp = SplineSetStroke(test,&si,NULL);
temp = SplineSetStroke(test,&si,false);
if ( new==NULL )
new=temp;
else
@ -175,6 +178,7 @@ static SplinePointList *localSplinesFromEntities(Entity *ent, Color bgcol, int i
return( head );
}
#if !defined(__MINGW32__)
/* I think this is total paranoia. but it's annoying to have linker complaints... */
static int mytempnam(char *buffer) {
char *dir;
@ -225,7 +229,109 @@ return( NULL );
return( NULL );
}
}
#endif
#if defined(__MINGW32__)
static char* add_arg(char* buffer, char* s)
{
while( *s ) *buffer++ = *s++;
*buffer = '\0';
return buffer;
}
void _SCAutoTrace(SplineChar *sc, int layer, char **args) {
ImageList *images;
SplineSet *new, *last;
struct _GImage *ib;
Color bgcol;
int ispotrace;
real transform[6];
char tempname_in[1025];
char tempname_out[1025];
char *prog, *command, *cmd;
FILE *ps;
int i, changed = false;
if ( sc->layers[ly_back].images==NULL )
return;
prog = FindAutoTraceName();
if ( prog==NULL )
return;
ispotrace = (strstrmatch(prog,"potrace")!=NULL );
for ( images = sc->layers[ly_back].images; images!=NULL; images=images->next ) {
ib = images->image->list_len==0 ? images->image->u.image : images->image->u.images[0];
if ( ib->width==0 || ib->height==0 ) {
continue;
}
strcpy(tempname_in, _tempnam(NULL, "FontForge_in_"));
strcpy(tempname_out, _tempnam(NULL, "FontForge_out_"));
GImageWriteBmp(images->image, tempname_in);
if ( ib->trans==-1 )
bgcol = 0xffffff; /* reasonable guess */
else if ( ib->image_type==it_true )
bgcol = ib->trans;
else if ( ib->clut!=NULL )
bgcol = ib->clut->clut[ib->trans];
else
bgcol = 0xffffff;
command = galloc(32768);
cmd = add_arg(command, prog);
cmd = add_arg(cmd, " ");
if(args){
for(i=0; args[i]; i++){
cmd = add_arg(cmd, args[i]);
cmd = add_arg(cmd, " ");
}
}
if ( ispotrace )
cmd = add_arg(cmd, "-c --eps -r 72 --output=\"");
else
cmd = add_arg(cmd, "--output-format=eps --input-format=BMP --output-file \"");
cmd = add_arg(cmd, tempname_out);
cmd = add_arg(cmd, "\" \"");
cmd = add_arg(cmd, tempname_in);
cmd = add_arg(cmd, "\"");
/*fprintf(stdout, "---EXEC---\n%s\n----------\n", command);fflush(stdout);*/
system(command);
gfree(command);
ps = fopen(tempname_out, "r");
if(ps){
new = localSplinesFromEntities(EntityInterpretPS(ps,NULL),bgcol,ispotrace);
transform[0] = images->xscale; transform[3] = images->yscale;
transform[1] = transform[2] = 0;
transform[4] = images->xoff;
transform[5] = images->yoff - images->yscale*ib->height;
new = SplinePointListTransform(new,transform,tpt_AllPoints);
if ( sc->layers[layer].order2 ) {
SplineSet *o2 = SplineSetsTTFApprox(new);
SplinePointListsFree(new);
new = o2;
}
if ( new!=NULL ) {
sc->parent->onlybitmaps = false;
if ( !changed )
SCPreserveLayer(sc,layer,false);
for ( last=new; last->next!=NULL; last=last->next );
last->next = sc->layers[layer].splines;
sc->layers[layer].splines = new;
changed = true;
}
fclose(ps);
}
unlink(tempname_in);
unlink(tempname_out);
}
if ( changed )
SCCharChangedUpdate(sc,layer);
}
#else
void _SCAutoTrace(SplineChar *sc, int layer, char **args) {
ImageList *images;
char *prog, *pt;
@ -316,7 +422,7 @@ return;
transform[1] = transform[2] = 0;
transform[4] = images->xoff;
transform[5] = images->yoff - images->yscale*ib->height;
new = SplinePointListTransform(new,transform,true);
new = SplinePointListTransform(new,transform,tpt_AllPoints);
if ( sc->layers[layer].order2 ) {
SplineSet *o2 = SplineSetsTTFApprox(new);
SplinePointListsFree(new);
@ -340,6 +446,7 @@ return;
if ( changed )
SCCharChangedUpdate(sc,layer);
}
#endif
static char **makevector(const char *str) {
char **vector;
@ -638,6 +745,9 @@ return( mf_args );
}
SplineFont *SFFromMF(char *filename) {
#if defined(__MINGW32__)
return (NULL);
#else
char *tempdir;
char *arglist[8];
int pid, status, ac, i;
@ -720,4 +830,5 @@ return( NULL );
free(arglist[1]);
cleantempdir(tempdir);
return( sf );
#endif
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -357,7 +357,7 @@ return( min );
SplineFindExtrema(&spline->splines[1], &t1, &t2 );
tbase = 0;
if ( t1!=-1 ) {
t = SplineSolve(&spline->splines[1],0,t1,y,.01);
t = SplineSolve(&spline->splines[1],0,t1,y);
if ( t>=0 && t<=1 ) {
val = ((xsp->a*t+xsp->b)*t+xsp->c)*t + xsp->d;
if ( min==NOTREACHED || val<min )
@ -366,7 +366,7 @@ return( min );
tbase = t1;
}
if ( t2!=-1 ) {
t = SplineSolve(&spline->splines[1],tbase,t2,y,.01);
t = SplineSolve(&spline->splines[1],tbase,t2,y);
if ( t>=0 && t<=1 ) {
val = ((xsp->a*t+xsp->b)*t+xsp->c)*t + xsp->d;
if ( min==NOTREACHED || val<min )
@ -374,7 +374,7 @@ return( min );
}
tbase = t2;
}
t = SplineSolve(&spline->splines[1],tbase,1.0,y,.01);
t = SplineSolve(&spline->splines[1],tbase,1.0,y);
if ( t>=0 && t<=1 ) {
val = ((xsp->a*t+xsp->b)*t+xsp->c)*t + xsp->d;
if ( min==NOTREACHED || val<min )

1028
fontforge/autowidth2.c Normal file

File diff suppressed because it is too large Load Diff

84
fontforge/autowidth2.h Normal file
View File

@ -0,0 +1,84 @@
/* Copyright (C) 2009-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AUTOWIDTH2_H
# define _AUTOWIDTH2_H
typedef struct aw_glyph {
SplineChar *sc;
DBounds bb;
/*int zero_pos;*/
/*real min_y, max_y;*/
int imin_y, imax_y; /* floor(bb.min_y/sub_height) */
/* Allocate two arrays [min_y/sub_height,max_y/sub_height) */
/* normalize so that min_y = sub_height*floor(bb.miny/sub_height) */
/* max_y = sub_height*ceil (bb.maxy/sub_height) */
/* left[i] is the minimum x value any spline attains between min_y+i*sub_hight and min_y+(i+1)*sub_height */
/* in other words, it is a sampling of the left edge of the glyph */
/* Similarly right is a sampling of the right edge */
/* The left array is normalized so that the smallest leftmost extent is 0 */
/* (left side bearing set to zero) so all entries will be non-negative */
/* Conversely the right array is normalized so that the greatest right extent is 0 */
/* so all entries will be non-positive */
short *left;
short *right;
int lsb, rsb; /* approximations we refine as we go along */
int nlsb, nrsb; /* next guess */
#if !defined(_NO_PYTHON)
void *python_data;
#endif
} AW_Glyph;
typedef struct aw_data {
SplineFont *sf;
FontViewBase *fv;
int layer;
/*uint32 *script_list;*/
AW_Glyph *glyphs;
int gcnt;
int *visual_separation; /* array[gcnt][gcnt] of my guess at the visual */
/* separation between all pairs of glyphs */
/* array[index_left_glyph*gcnt+index_right_glyph] */
/* Only used for width, not kern */
int sub_height; /* Each glyph is divided into vertical chunks this high */
int loop_cnt; /* Number of times to iterate... */
int desired_separation;
int min_sidebearing, max_sidebearing;
unsigned int normalize: 1;
real denom;
#if !defined(_NO_PYTHON)
void *python_data;
#endif
} AW_Data;
#if !defined(_NO_PYTHON)
extern void *PyFF_GlyphSeparationHook;
extern int PyFF_GlyphSeparation(AW_Glyph *g1,AW_Glyph *g2,AW_Data *all);
extern void FFPy_AWGlyphFree(AW_Glyph *me);
extern void FFPy_AWDataFree(AW_Data *all);
#endif /* PYTHON */
#endif /* _AUTOWIDTH2_H */

325
fontforge/autowidth2dlg.c Normal file
View File

@ -0,0 +1,325 @@
/* Copyright (C) 2009-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fontforgeui.h"
#include <math.h>
#include <ustring.h>
#include <utype.h>
#include <gkeysym.h>
static int width_last_em_size=1000;
static int width_separation=150;
static int width_min_side_bearing=10;
static int width_max_side_bearing=300;
static int width_chunk_height=10;
static int width_loop_cnt=1;
#define CID_Separation 1001
#define CID_MinSep 1002
#define CID_MaxSep 1003
#define CID_Height 1004
#define CID_Loop 1005
struct widthinfo {
int done;
GWindow gw;
FontView *fv;
SplineFont *sf;
};
static int AW2_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
GWindow gw = GGadgetGetWindow(g);
struct widthinfo *wi = GDrawGetUserData(gw);
int err = false;
int separation, min_side, max_side, height, loop;
separation = GetInt8(gw,CID_Separation, _("Separation"),&err);
min_side = GetInt8(gw,CID_MinSep, _("Min Bearing"),&err);
max_side = GetInt8(gw,CID_MaxSep, _("Max Bearing"),&err);
height = GetInt8(gw,CID_Height, _("Height"),&err);
loop = GetInt8(gw,CID_Loop, _("Loop Count"),&err);
if ( err )
return( true );
GDrawSetVisible(gw,false);
GDrawSync(NULL);
GDrawProcessPendingEvents(NULL);
width_last_em_size = wi->sf->ascent + wi->sf->descent;
width_separation = separation;
wi->sf->width_separation=separation;
if ( wi->sf->italicangle==0 )
width_min_side_bearing = min_side;
width_max_side_bearing = max_side;
width_chunk_height = height;
width_loop_cnt = loop;
AutoWidth2((FontViewBase *) wi->fv,separation,min_side,max_side,
height, loop);
wi->done = true;
}
return( true );
}
static int AW2_Cancel(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
GWindow gw = GGadgetGetWindow(g);
struct widthinfo *wi = GDrawGetUserData(gw);
wi->done = true;
}
return( true );
}
static int AW2_e_h(GWindow gw, GEvent *event) {
if ( event->type==et_close ) {
struct widthinfo *wi = GDrawGetUserData(gw);
wi->done = true;
} else if ( event->type == et_char ) {
if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
/*struct widthinfo *wi = GDrawGetUserData(gw);*/
help("autowidth.html#AutoWidth");
return( true );
}
return( false );
}
return( true );
}
void FVAutoWidth2(FontView *fv) {
struct widthinfo wi;
GWindow gw;
GWindowAttrs wattrs;
GRect pos;
GGadgetCreateData *harray1[4], *harray2[6], *harray3[6], *barray[9], *varray[14];
GGadgetCreateData gcd[29], boxes[6];
GTextInfo label[29];
int i,v;
char sepbuf[20], minbuf[20], maxbuf[20], hbuf[20], lbuf[20];
SplineFont *sf = fv->b.sf;
double emsize = (sf->ascent + sf->descent);
memset(&wi,0,sizeof(wi));
wi.fv = fv;
wi.sf = sf;
memset(&wattrs,0,sizeof(wattrs));
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg;
wattrs.event_masks = ~(1<<et_charup);
wattrs.restrict_input_to_me = 1;
wattrs.is_dlg = 1;
wattrs.undercursor = 1;
wattrs.cursor = ct_pointer;
wattrs.utf8_window_title = _("Auto Width");
pos.x = pos.y = 0;
pos.width = GGadgetScale(GDrawPointsToPixels(NULL,200));
pos.height = GDrawPointsToPixels(NULL,180);
wi.gw = gw = GDrawCreateTopWindow(NULL,&pos,AW2_e_h,&wi,&wattrs);
memset(&label,0,sizeof(label));
memset(&boxes,0,sizeof(boxes));
memset(&gcd,0,sizeof(gcd));
i = v = 0;
label[i].text = (unichar_t *) _(
"FontForge will attempt to adjust the left and right\n"
"sidebearings of the selected glyphs so that the average\n"
"separation between glyphs in a script will be the\n"
"specified amount. You may also specify a minimum and\n"
"maximum value for each glyph's sidebearings." );
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
varray[v++] = &gcd[i-1]; varray[v++] = NULL;
label[i].text = (unichar_t *) _( "_Separation:" );
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
harray1[0] = &gcd[i-1];
if ( sf->width_separation>0 )
sprintf( sepbuf, "%d", sf->width_separation );
else
sprintf( sepbuf, "%d", (int) rint( width_separation * emsize / width_last_em_size ));
label[i].text = (unichar_t *) sepbuf;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_Separation;
gcd[i++].creator = GTextFieldCreate;
harray1[1] = &gcd[i-1]; harray1[2] = GCD_Glue; harray1[3] = NULL;
boxes[2].gd.flags = gg_enabled|gg_visible;
boxes[2].gd.u.boxelements = harray1;
boxes[2].creator = GHBoxCreate;
varray[v++] = &boxes[2]; varray[v++] = NULL;
label[i].text = (unichar_t *) _( "_Min:" );
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
harray2[0] = &gcd[i-1];
#define PI 3.1415926535897932
if ( sf->italicangle<0 )
sprintf( minbuf, "%d", (int) rint( sf->descent*tan(sf->italicangle*PI/180 )) );
else if ( sf->italicangle>0 )
sprintf( minbuf, "%d", (int) -rint( sf->ascent*tan(sf->italicangle*PI/180 )) );
else
sprintf( minbuf, "%d", (int) rint( width_min_side_bearing * emsize / width_last_em_size ));
label[i].text = (unichar_t *) minbuf;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_MinSep;
gcd[i++].creator = GTextFieldCreate;
harray2[1] = &gcd[i-1];
label[i].text = (unichar_t *) _( "Ma_x:" );
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
harray2[2] = &gcd[i-1];
sprintf( maxbuf, "%d", (int) rint( width_max_side_bearing * emsize / width_last_em_size ));
label[i].text = (unichar_t *) maxbuf;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_MaxSep;
gcd[i++].creator = GTextFieldCreate;
harray2[3] = &gcd[i-1]; harray2[4] = GCD_Glue; harray2[5] = NULL;
boxes[3].gd.flags = gg_enabled|gg_visible;
boxes[3].gd.u.boxelements = harray2;
boxes[3].creator = GHBoxCreate;
varray[v++] = &boxes[3]; varray[v++] = NULL;
label[i].text = (unichar_t *) _( "_Height:" );
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = /* gg_visible |*/ gg_enabled;
gcd[i++].creator = GLabelCreate;
harray3[0] = &gcd[i-1];
sprintf( hbuf, "%d", (int) rint( width_chunk_height * emsize / width_last_em_size ));
label[i].text = (unichar_t *) hbuf;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = /* gg_visible |*/ gg_enabled;
gcd[i].gd.cid = CID_Height;
gcd[i++].creator = GTextFieldCreate;
harray3[1] = &gcd[i-1];
label[i].text = (unichar_t *) _( "_Loops:" );
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = /* gg_visible |*/ gg_enabled;
gcd[i++].creator = GLabelCreate;
harray3[2] = &gcd[i-1];
sprintf( lbuf, "%d", (int) rint( width_loop_cnt * emsize / width_last_em_size ));
label[i].text = (unichar_t *) lbuf;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = /* gg_visible |*/ gg_enabled;
gcd[i].gd.cid = CID_Loop;
gcd[i++].creator = GTextFieldCreate;
harray3[3] = &gcd[i-1]; harray3[4] = GCD_Glue; harray3[5] = NULL;
boxes[4].gd.flags = gg_enabled/*|gg_visible*/;
boxes[4].gd.u.boxelements = harray3;
boxes[4].creator = GHBoxCreate;
varray[v++] = &boxes[4]; varray[v++] = NULL;
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default;
label[i].text = (unichar_t *) _("_OK");
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.handle_controlevent = AW2_OK;
gcd[i++].creator = GButtonCreate;
barray[0] = GCD_Glue; barray[1] = &gcd[i-1]; barray[2] = GCD_Glue;
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
label[i].text = (unichar_t *) _("_Cancel");
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.handle_controlevent = AW2_Cancel;
gcd[i++].creator = GButtonCreate;
barray[3] = barray[4] = GCD_Glue;
barray[5] = &gcd[i-1]; barray[6] = GCD_Glue; barray[7] = NULL;
boxes[5].gd.flags = gg_enabled|gg_visible;
boxes[5].gd.u.boxelements = barray;
boxes[5].creator = GHBoxCreate;
varray[v++] = GCD_Glue; varray[v++] = NULL;
varray[v++] = &boxes[5]; varray[v++] = NULL; varray[v++] = NULL;
boxes[0].gd.pos.x = gcd[i].gd.pos.y = 2;
boxes[0].gd.flags = gg_enabled|gg_visible;
boxes[0].gd.u.boxelements = varray;
boxes[0].creator = GHVGroupCreate;
GGadgetsCreate(gw,boxes);
GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue);
GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue);
GHVBoxSetExpandableCol(boxes[3].ret,gb_expandglue);
GHVBoxSetExpandableCol(boxes[4].ret,gb_expandglue);
GHVBoxSetExpandableCol(boxes[5].ret,gb_expandgluesame);
GHVBoxFitWindow(boxes[0].ret);
GWidgetIndicateFocusGadget(gcd[2].ret);
GTextFieldSelect(gcd[2].ret,0,-1);
GWidgetHidePalettes();
GDrawSetVisible(gw,true);
while ( !wi.done )
GDrawProcessOneEvent(NULL);
GDrawDestroyWindow(gw);
}

View File

@ -1,601 +0,0 @@
/* Copyright (C) 2000-2008 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include <math.h>
#include <ustring.h>
#include <utype.h>
#include <gkeysym.h>
#include "autowidth.h"
static GTextInfo widthlist[] = {
{ (unichar_t *) N_("A-Za-z0-9"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
/* gettext gets very unhappy with things outside of ASCII and removes them */
{ (unichar_t *) NU_("Α-ΡΣ-Ωα-ω"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("ЂЄ-ІЈ-ЋЏ-ИК-Яа-ик-яђє-іј-ћџ"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("All"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("Selected"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
NULL };
static GTextInfo kernllist[] = {
{ (unichar_t *) N_("A-Za-z"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("Α-ΡΣ-Ωα-ω"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("ЂЄ-ІЈ-ЋЏ-ИК-Яа-ик-яђє-іј-ћџ"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("All"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("Selected"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
NULL };
static GTextInfo kernrlist[] = {
{ (unichar_t *) N_("a-z.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("A-Za-z.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("α-ω.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("Α-ΡΣ-Ωα-ω.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("а-ик-яђє-іј-ћџ.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) NU_("ЂЄ-ІЈ-ЋЏ-ИК-Яа-ик-яђє-іј-ћџ.,:;-"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("All"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
{ (unichar_t *) N_("Selected"), NULL, 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 1},
NULL };
static void AutoWidthInit(void) {
static int done=false;
int i;
if ( done )
return;
for ( i=0; widthlist[i].text!=NULL; ++i )
widthlist[i].text = (unichar_t *) _((char *) widthlist[i].text);
for ( i=0; kernllist[i].text!=NULL; ++i )
kernllist[i].text = (unichar_t *) _((char *) kernllist[i].text);
for ( i=0; kernrlist[i].text!=NULL; ++i )
kernrlist[i].text = (unichar_t *) _((char *) kernrlist[i].text);
done = true;
}
#define CID_Spacing 1001
#define CID_Total 1002
#define CID_Threshold 1003
#define CID_OnlyNeg 1004
#define CID_Left 1010
#define CID_Right 1020
#define CID_Subtable 1030
#define CID_Browse 2001
#define CID_OK 2002
static void ReplaceGlyphWith(SplineFont *sf, struct charone **ret, int cnt, int ch1, int ch2 ) {
int s,e,j;
for ( s=0; s<cnt; ++s )
if ( ret[s]->sc->unicodeenc==ch1 )
break;
if ( s!=cnt && ( j=SFFindExistingSlot(sf,ch2,NULL))!=-1 &&
sf->glyphs[j]->width==ret[s]->sc->width && /* without this, they won't sync up */
ret[s]->sc->layers[ly_fore].refs!=NULL &&
(ret[s]->sc->layers[ly_fore].refs->sc->unicodeenc==ch2 ||
(ret[s]->sc->layers[ly_fore].refs->next!=NULL &&
ret[s]->sc->layers[ly_fore].refs->next->sc->unicodeenc==ch2)) ) {
for ( e=0; e<cnt; ++e )
if ( ret[e]->sc->unicodeenc==ch2 )
break;
if ( e==cnt )
ret[s]->sc = sf->glyphs[j];
}
}
static struct charone **BuildCharList(FontView *fv, SplineFont *sf,GWindow gw,
int base, int *tot, int *rtot, int *ipos, int iswidth) {
int i, cnt, rcnt=0, doit, s, e;
struct charone **ret=NULL;
int all, sel;
const unichar_t *str, *pt;
int gid;
str = _GGadgetGetTitle(GWidgetGetControl(gw,base));
all = uc_strcmp(str,_("All"))==0;
sel = uc_strcmp(str,_("Selected"))==0;
for ( doit=0; doit<2; ++doit ) {
if ( all ) {
for ( i=cnt=0; i<sf->glyphcnt && cnt<300; ++i ) {
if ( SCWorthOutputting(sf->glyphs[i]) ) {
if ( doit )
ret[cnt++] = AW_MakeCharOne(sf->glyphs[i]);
else
++cnt;
}
}
} else if ( sel ) {
EncMap *map = fv->b.map;
for ( i=cnt=0; i<map->enccount && cnt<300; ++i ) {
if ( fv->b.selected[i] && (gid=map->map[i])!=-1 && SCWorthOutputting(sf->glyphs[gid]) ) {
if ( doit )
ret[cnt++] = AW_MakeCharOne(sf->glyphs[i]);
else
++cnt;
}
}
} else {
for ( pt=str, cnt=0; *pt && cnt<300 ; ) {
if ( pt[1]=='-' && pt[2]!='\0' ) {
s = pt[0]; e = pt[2];
pt += 3;
} else {
s = e = pt[0];
++pt;
}
for ( ; s<=e && cnt<300 ; ++s ) {
i = SFFindExistingSlot(sf,s,NULL);
if ( i!=-1 && sf->glyphs[i]!=NULL &&
(sf->glyphs[i]->layers[ly_fore].splines!=NULL || sf->glyphs[i]->layers[ly_fore].refs!=NULL )) {
if ( doit )
ret[cnt++] = AW_MakeCharOne(sf->glyphs[i]);
else
++cnt;
}
}
}
}
if ( cnt==0 )
break;
if ( !doit )
ret = galloc((cnt+2)*sizeof(struct charone *));
else {
rcnt = cnt;
/* If lower case i is used, and it's a composite, then use */
/* dotlessi instead */ /* could do the same for dotless j */
if ( iswidth ) {
ReplaceGlyphWith(sf,ret,cnt,'i',0x131);
ReplaceGlyphWith(sf,ret,cnt,'j',0x237);
}
if ( iswidth && /* I always want 'I' in the character list when doing widths */
/* or at least when doing widths of LGC alphabets where */
/* concepts like serifs make sense */
(( ret[0]->sc->unicodeenc>='A' && ret[0]->sc->unicodeenc<0x530) ||
( ret[0]->sc->unicodeenc>=0x1d00 && ret[0]->sc->unicodeenc<0x2000)) ) {
for ( s=0; s<cnt; ++s )
if ( ret[s]->sc->unicodeenc=='I' )
break;
if ( s==cnt ) {
i = SFFindExistingSlot(sf,'I',NULL);
if ( i!=-1 && sf->glyphs[i]!=NULL &&
(sf->glyphs[i]->layers[ly_fore].splines!=NULL || sf->glyphs[i]->layers[ly_fore].refs!=NULL ))
ret[cnt++] = AW_MakeCharOne(sf->glyphs[i]);
else
s = -1;
}
*ipos = s;
}
ret[cnt] = NULL;
}
}
*tot = cnt;
*rtot = rcnt;
return( ret );
}
static int AW_Subtable(GGadget *g, GEvent *e) {
WidthInfo *wi = GDrawGetUserData(GGadgetGetWindow(g));
GTextInfo *ti;
struct lookup_subtable *sub;
struct subtable_data sd;
if ( e->type==et_controlevent && e->u.control.subtype == et_listselected ) {
ti = GGadgetGetListItemSelected(g);
if ( ti!=NULL ) {
if ( ti->userdata!=NULL )
wi->subtable = ti->userdata;
else {
memset(&sd,0,sizeof(sd));
sd.flags = sdf_horizontalkern | sdf_kernpair;
sub = SFNewLookupSubtableOfType(wi->sf,gpos_pair,&sd,wi->layer);
if ( sub!=NULL ) {
wi->subtable = sub;
GGadgetSetList(g,SFSubtablesOfType(wi->sf,gpos_pair,false,false),false);
}
}
}
}
return( true );
}
static int AW_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
GWindow gw = GGadgetGetWindow(g);
WidthInfo *wi = GDrawGetUserData(gw);
int err = false;
int tot;
wi->spacing = GetReal8(gw,CID_Spacing, _("Spacing"),&err);
if ( wi->autokern ) {
wi->threshold = GetInt8(gw,CID_Threshold, _("Threshold:"), &err);
wi->onlynegkerns = GGadgetIsChecked(GWidgetGetControl(gw,CID_OnlyNeg));
tot = GetInt8(gw,CID_Total, _("Total Kerns:"), &err);
if ( tot<0 ) tot = 0;
}
if ( err )
return( true );
if ( wi->autokern && wi->subtable==NULL ) {
ff_post_error(_("Select a subtable"),_("You must select a lookup subtable in which to store the kerning pairs"));
return( true );
}
aw_old_sf = wi->sf;
aw_old_spaceguess = wi->spacing;
wi->done = true;
GDrawSetVisible(gw,false);
GDrawSync(NULL);
GDrawProcessPendingEvents(NULL);
if ( GGadgetGetCid(g)==CID_OK ) {
wi->left = BuildCharList((FontView *) wi->fv, wi->sf,gw,CID_Left, &wi->lcnt, &wi->real_lcnt, &wi->l_Ipos, !wi->autokern );
wi->right = BuildCharList((FontView *) wi->fv, wi->sf,gw,CID_Right, &wi->rcnt, &wi->real_rcnt, &wi->r_Ipos, !wi->autokern );
if ( wi->real_lcnt==0 || wi->real_rcnt==0 ) {
AW_FreeCharList(wi->left);
AW_FreeCharList(wi->right);
ff_post_error(_("No glyphs selected."),_("No glyphs selected."));
return( true );
}
AW_ScriptSerifChecker(wi);
AW_InitCharPairs(wi);
} else {
char *fn = gwwv_open_filename(_("Load Kern Pairs"), NULL, "*.txt", NULL);
if ( fn==NULL ) {
GDrawSetVisible(gw,true);
wi->done = false;
return( true );
}
if ( !AW_ReadKernPairFile(fn,wi)) {
GDrawSetVisible(gw,true);
wi->done = false;
return( true );
}
}
AW_BuildCharPairs(wi);
if ( wi->autokern ) {
AW_AutoKern(wi);
AW_KernRemoveBelowThreshold(wi->sf,KernThreshold(wi->sf,tot));
} else
AW_AutoWidth(wi);
AW_FreeCharList(wi->left);
AW_FreeCharList(wi->right);
AW_FreeCharPairs(wi->pairs,wi->pcnt);
}
return( true );
}
static int AW_Cancel(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
GWindow gw = GGadgetGetWindow(g);
WidthInfo *wi = GDrawGetUserData(gw);
wi->done = true;
}
return( true );
}
static int AW_e_h(GWindow gw, GEvent *event) {
if ( event->type==et_close ) {
WidthInfo *wi = GDrawGetUserData(gw);
wi->done = true;
} else if ( event->type == et_char ) {
if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) {
WidthInfo *wi = GDrawGetUserData(gw);
help(wi->autokern?"autowidth.html#AutoKern":"autowidth.html#AutoWidth");
return( true );
}
return( false );
}
return( true );
}
#define SelHeight 34
static int MakeSelGadgets(GGadgetCreateData *gcd, GTextInfo *label,
int i, int base, char *labr, int y, int toomany, int autokern,
GGadgetCreateData **hvarray) {
char *std = !autokern ? _("A-Za-z0-9") :
base==CID_Left ? _("A-Za-z") :
_("a-z.,:;-");
int epos;
label[i].text = (unichar_t *) labr;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 12; gcd[i].gd.pos.y = y;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
hvarray[0] = &gcd[i-1];
label[i].text = (unichar_t *) std;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 12; gcd[i].gd.pos.y = y+14;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.u.list = !autokern ? widthlist : base==CID_Left ? kernllist : kernrlist;
gcd[i].gd.cid = base;
gcd[i++].creator = GListFieldCreate;
hvarray[1] = &gcd[i-1]; hvarray[2] = NULL;
for ( epos = 0; gcd[i-1].gd.u.list[epos].text!=NULL; ++epos );
gcd[i-1].gd.u.list[epos-2].disabled = (toomany&1);
gcd[i-1].gd.u.list[epos-1].disabled = (toomany&2)?1:0;
return( i );
}
static int SFCount(SplineFont *sf) {
int i, cnt;
for ( i=cnt=0; i<sf->glyphcnt; ++i )
if ( SCWorthOutputting(sf->glyphs[i]) )
++cnt;
return( cnt );
}
static int SFCountSel(FontView *fv, SplineFont *sf) {
int i, cnt;
uint8 *sel = fv->b.selected;
EncMap *map = fv->b.map;
for ( i=cnt=0; i<map->enccount; ++i ) if ( sel[i] ) {
int gid = map->map[i];
if ( gid!=-1 && SCWorthOutputting(sf->glyphs[gid]))
++cnt;
}
return( cnt );
}
static void AutoWKDlg(FontView *fv,int autokern) {
WidthInfo wi;
GWindow gw;
GWindowAttrs wattrs;
GRect pos;
GGadgetCreateData *hvarray[24], *varray[10], *h3array[8];
GGadgetCreateData gcd[29];
GTextInfo label[29];
int i, y, selfield, v;
char buffer[30], buffer2[30];
SplineFont *sf = fv->b.sf;
int selcnt = SFCountSel(fv,sf);
int toomany = ((SFCount(sf)>=300)?1:0) | ((selcnt==0 || selcnt>=300)?2:0);
memset(&wi,'\0',sizeof(wi));
wi.autokern = autokern;
wi.layer = fv->b.active_layer;
wi.sf = sf;
wi.fv = (FontViewBase *) fv;
AW_FindFontParameters(&wi);
AutoWidthInit();
memset(&wattrs,0,sizeof(wattrs));
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg;
wattrs.event_masks = ~(1<<et_charup);
wattrs.restrict_input_to_me = 1;
wattrs.is_dlg = 1;
wattrs.undercursor = 1;
wattrs.cursor = ct_pointer;
wattrs.utf8_window_title = autokern?_("Auto Kern"):_("Auto Width");
pos.x = pos.y = 0;
pos.width = GGadgetScale(GDrawPointsToPixels(NULL,200));
pos.height = GDrawPointsToPixels(NULL,autokern?270:180);
gw = GDrawCreateTopWindow(NULL,&pos,AW_e_h,&wi,&wattrs);
memset(&label,0,sizeof(label));
memset(&gcd,0,sizeof(gcd));
i = 0;
label[i].text = (unichar_t *) _("Enter two glyph ranges to be adjusted.");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = 6;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
varray[0] = &gcd[i-1]; varray[1] = NULL;
i = MakeSelGadgets(gcd, label, i, CID_Left, _("Glyphs on Left"), 21,
toomany, autokern, hvarray );
varray[2] = &gcd[i-1]; varray[3] = NULL;
selfield = i-1;
i = MakeSelGadgets(gcd, label, i, CID_Right, _("Glyphs on Right"), 21+SelHeight+9,
toomany, autokern, hvarray+3 );
y = 32+2*(SelHeight+9);
label[i].text = (unichar_t *) _("Spacing");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = y+7;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
hvarray[6] = &gcd[i-1];
sprintf( buffer, "%d", wi.space_guess );
label[i].text = (unichar_t *) buffer;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 65; gcd[i].gd.pos.y = y+3;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_Spacing;
gcd[i++].creator = GTextFieldCreate;
hvarray[7] = &gcd[i-1]; hvarray[8] = NULL;
y += 32;
if ( autokern ) {
y -= 4;
label[i].text = (unichar_t *) _("Total Kerns:");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = y+7;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
hvarray[9] = &gcd[i-1];
label[i].text = (unichar_t *) "2048";
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 65; gcd[i].gd.pos.y = y+3;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_Total;
gcd[i++].creator = GTextFieldCreate;
hvarray[10] = &gcd[i-1]; hvarray[11] = NULL;
y += 28;
label[i].text = (unichar_t *) _("Threshold:");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = y+7;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i++].creator = GLabelCreate;
hvarray[12] = &gcd[i-1];
sprintf( buffer2, "%d", (sf->ascent+sf->descent)/25 );
label[i].text = (unichar_t *) buffer2;
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 65; gcd[i].gd.pos.y = y+3;
gcd[i].gd.flags = gg_visible | gg_enabled;
gcd[i].gd.cid = CID_Threshold;
gcd[i++].creator = GTextFieldCreate;
hvarray[13] = &gcd[i-1]; hvarray[14] = NULL;
y += 32;
gcd[i].gd.flags = gg_enabled | gg_visible | gg_cb_on;
label[i].text = (unichar_t *) _("Only kern glyphs closer");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.cid = CID_OnlyNeg;
gcd[i++].creator = GCheckBoxCreate;
hvarray[15] = GCD_Glue; hvarray[16] = &gcd[i-1]; hvarray[17] = NULL;
gcd[i].gd.flags = gg_enabled | gg_visible;
label[i].text = (unichar_t *) _("Lookup subtable:");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i++].creator = GLabelCreate;
hvarray[18] = &gcd[i-1];
gcd[i].gd.flags = gg_enabled|gg_visible;
gcd[i].gd.cid = CID_Subtable;
gcd[i].gd.handle_controlevent = AW_Subtable;
gcd[i++].creator = GListButtonCreate;
hvarray[19] = &gcd[i-1]; hvarray[20] = NULL; hvarray[21] = NULL;
} else
hvarray[9] = NULL;
gcd[i].gd.flags = gg_enabled|gg_visible;
gcd[i].gd.u.boxelements = hvarray;
gcd[i++].creator = GHVBoxCreate;
varray[2] = &gcd[i-1]; varray[3] = NULL;
v = 4;
varray[v++] = GCD_Glue; varray[v++] = NULL;
gcd[i].gd.pos.x = 30-3; gcd[i].gd.pos.y = y-3;
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default;
label[i].text = (unichar_t *) _("_OK");
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.mnemonic = 'O';
gcd[i].gd.label = &label[i];
gcd[i].gd.handle_controlevent = AW_OK;
gcd[i].gd.cid = CID_OK;
gcd[i++].creator = GButtonCreate;
h3array[0] = GCD_Glue; h3array[1] = &gcd[i-1]; h3array[2] = GCD_Glue;
if ( autokern ) {
gcd[i].gd.pos.x = (200-gcd[i].gd.pos.width)/2; gcd[i].gd.pos.y = y;
gcd[i].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
label[i].text = (unichar_t *) _("_Browse...");
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.handle_controlevent = AW_OK; /* Yes, really */
gcd[i].gd.popup_msg = (unichar_t *) _("Browse for a file containing a list of kerning pairs\ntwo characters per line. FontForge will only check\nthose pairs for kerning info.");
gcd[i].gd.cid = CID_Browse;
gcd[i++].creator = GButtonCreate;
h3array[3] = &gcd[i-1]; h3array[4] = GCD_Glue;
} else
h3array[3] = h3array[4] = GCD_Glue;
gcd[i].gd.pos.x = -30; gcd[i].gd.pos.y = y;
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
label[i].text = (unichar_t *) _("_Cancel");
label[i].text_is_1byte = true;
label[i].text_in_resource = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.mnemonic = 'C';
gcd[i].gd.handle_controlevent = AW_Cancel;
gcd[i++].creator = GButtonCreate;
h3array[5] = &gcd[i-1]; h3array[6] = GCD_Glue; h3array[7] = NULL;
gcd[i].gd.flags = gg_enabled|gg_visible;
gcd[i].gd.u.boxelements = h3array;
gcd[i++].creator = GHBoxCreate;
varray[v++] = &gcd[i-1]; varray[v++] = NULL; varray[v++] = NULL;
gcd[i].gd.pos.x = gcd[i].gd.pos.y = 2;
gcd[i].gd.flags = gg_enabled|gg_visible;
gcd[i].gd.u.boxelements = varray;
gcd[i].creator = GHVGroupCreate;
GGadgetsCreate(gw,gcd+i);
GHVBoxSetExpandableRow(gcd[i].ret,gb_expandglue);
GHVBoxSetExpandableCol(gcd[i-1].ret,gb_expandgluesame);
GHVBoxSetExpandableCol(varray[2]->ret,1);
if ( autokern ) {
GTextInfo *ti;
GGadgetSetList(hvarray[19]->ret,SFSubtablesOfType(sf,gpos_pair,false,false),false);
ti = GGadgetGetListItemSelected(hvarray[19]->ret);
if ( ti==NULL ) {
int32 len,j;
GTextInfo **list = GGadgetGetList(hvarray[19]->ret,&len);
for ( j=0; j<len; ++j )
if ( !list[j]->disabled && !list[j]->line ) {
ti = list[j];
GGadgetSelectOneListItem(hvarray[19]->ret,j);
break;
}
}
if ( ti!=NULL )
wi.subtable = ti->userdata;
}
GHVBoxFitWindow(gcd[i].ret);
GWidgetIndicateFocusGadget(gcd[selfield].ret);
GTextFieldSelect(gcd[selfield].ret,0,-1);
GWidgetHidePalettes();
GDrawSetVisible(gw,true);
while ( !wi.done )
GDrawProcessOneEvent(NULL);
GDrawDestroyWindow(gw);
}
void FVAutoKern(FontView *fv) {
AutoWKDlg(fv,true);
}
void FVAutoWidth(FontView *fv) {
AutoWKDlg(fv,false);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008 by George Williams */
/* Copyright (C) 2008-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <ustring.h>
#include <chardata.h>
#include <utype.h>
@ -445,7 +445,7 @@ static void Base_FinishEdit(GGadget *g, int r, int c, int wasnew) {
script == CHR('g','u','j','r' ) || script == CHR('g','j','r','2') ||
script == CHR('g','u','r','u' ) || script == CHR('g','u','r','2') ||
script == CHR('k','n','d','a' ) || script == CHR('k','n','d','2') ||
script == CHR('m','l','y','m' ) || script == CHR('m','l','y','2') ||
script == CHR('m','l','y','m' ) || script == CHR('m','l','m','2') ||
script == CHR('o','r','y','a' ) || script == CHR('o','r','y','2') ||
script == CHR('t','a','m','l' ) || script == CHR('t','m','l','2') ||
script == CHR('t','e','l','u' ) || script == CHR('t','e','l','2'))
@ -719,7 +719,7 @@ struct Base *SFBaselines(SplineFont *sf,struct Base *old,int is_vertical) {
wattrs.restrict_input_to_me = true;
wattrs.undercursor = 1;
wattrs.cursor = ct_pointer;
snprintf(buffer,sizeof(buffer),is_vertical ? _("Vertical Baselines") : _("Horizontal Baselines") );
snprintf(buffer,sizeof(buffer),"%s", is_vertical ? _("Vertical Baselines") : _("Horizontal Baselines") );
wattrs.utf8_window_title = buffer;
wattrs.is_dlg = true;
pos.x = pos.y = 0;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -29,7 +29,7 @@
#include "splinefont.h"
enum widthtype { wt_width, wt_lbearing, wt_rbearing, wt_vwidth };
enum widthtype { wt_width, wt_lbearing, wt_rbearing, wt_bearings, wt_vwidth };
enum fvtrans_flags { fvt_alllayers=1, fvt_round_to_int=2,
fvt_dontsetwidth=4, fvt_dontmovewidth=8, fvt_scalekernclasses=0x10,
@ -91,7 +91,7 @@ enum cvtools { cvt_pointer, cvt_magnify,
enum bvtools { bvt_pointer, bvt_magnify,
bvt_pencil, bvt_line,
bvt_shift, bvt_hand,
bvt_minify, bvt_eyedropper, bvt_max=bvt_eyedropper,
bvt_minify, bvt_max=bvt_minify, bvt_eyedropper,
bvt_setwidth, bvt_setvwidth,
bvt_rect, bvt_filledrect,
bvt_elipse, bvt_filledelipse,
@ -120,7 +120,7 @@ struct cvcontainer {
enum nav_type { nt_prevdef, nt_prev, nt_goto, nt_next, nt_nextdef };
struct cvcontainer_funcs {
enum cv_container_type { cvc_searcher, cvc_mathkern, cvc_tilepath,
cvc_gradient, cvc_multiplepattern } type;
cvc_gradient, cvc_multiplepattern, cvc_stroke } type;
void (*activateMe)(struct cvcontainer *cvc,struct charviewbase *cv);
void (*charEvent)(struct cvcontainer *cvc,void *event);
int (*canNavigate)(struct cvcontainer *cvc,enum nav_type type);
@ -141,6 +141,20 @@ typedef struct charviewbase {
struct cvcontainer *container; /* The sv (or whatever) within which this view is embedded (if it is embedded) */
} CharViewBase;
struct fvcontainer {
struct fvcontainer_funcs *funcs;
};
struct fvcontainer_funcs {
enum fv_container_type { fvc_kernformat, fvc_glyphset } type;
int is_modal; /* If the fvc is in a modal dialog then we can't create modeless windows (like charviews, fontinfo, etc.) */
void (*activateMe)(struct fvcontainer *fvc,struct fontviewbase *fv);
void (*charEvent)(struct fvcontainer *fvc,void *event);
void (*doClose)(struct fvcontainer *fvc); /* Cancel the containing dlg? */
void (*doResize)(struct fvcontainer *fvc,struct fontviewbase *fv,int width,int height);
/* Resize the container so that fv fits */
};
typedef struct fontviewbase {
struct fontviewbase *next; /* Next on list of open fontviews */
struct fontviewbase *nextsame; /* Next fv looking at this font */
@ -157,6 +171,7 @@ typedef struct fontviewbase {
#ifndef _NO_PYTHON
void *python_fv_object;
#endif
struct fvcontainer *container;
} FontViewBase;
enum origins { or_zero, or_center, or_lastpress, or_value, or_undefined };
@ -252,6 +267,7 @@ enum fvformats { fv_bdf, fv_ttf, fv_pk, fv_pcf, fv_mac, fv_win, fv_palm,
extern enum undotype CopyUndoType(void);
extern int CopyContainsSomething(void);
extern int CopyContainsBitmap(void);
extern int CopyContainsVectors(void);
extern const Undoes *CopyBufferGet(void);
extern RefChar *CopyContainsRef(SplineFont *);
extern char **CopyGetPosSubData(enum possub_type *type,SplineFont **copied_from,
@ -264,6 +280,7 @@ extern void PasteRemoveAnchorClass(SplineFont *sf,AnchorClass *dying);
extern void ClipboardClear(void);
extern SplineSet *ClipBoardToSplineSet(void);
extern void BCCopySelected(BDFChar *bc,int pixelsize,int depth);
extern void BCCopyReference(BDFChar *bc,int pixelsize,int depth);
extern void PasteToBC(BDFChar *bc,int pixelsize,int depth);
extern void FVCopyWidth(FontViewBase *fv,enum undotype ut);
extern void FVCopyAnchors(FontViewBase *fv);
@ -324,6 +341,8 @@ extern void TransHints(StemInfo *stem,real mul1, real off1, real mul2, real off2
extern void TransDStemHints(DStemInfo *ds,real xmul, real xoff, real ymul, real yoff, int round_to_int );
extern void VrTrans(struct vr *vr,real transform[6]);
extern int SFNLTrans(FontViewBase *fv,char *x_expr,char *y_expr);
extern int SSNLTrans(SplineSet *ss,char *x_expr,char *y_expr);
extern int SCNLTrans(SplineChar *sc, int layer,char *x_expr,char *y_expr);
extern void FVPointOfView(FontViewBase *fv,struct pov_data *);
extern void FVStrokeItScript(void *fv, StrokeInfo *si,int pointless);
extern void FVOutline(struct fontviewbase *fv, real width);
@ -359,8 +378,9 @@ struct genericchange {
char *extension_for_letters, *extension_for_symbols;
double stem_height_scale, stem_width_scale;
double stem_height_add , stem_width_add ;
double stem_threshold;
double serif_height_scale, serif_width_scale;
double seirf_height_add , serif_width_add ;
double serif_height_add , serif_width_add ;
double hcounter_scale, hcounter_add;
double lsb_scale, lsb_add;
double rsb_scale, rsb_add;
@ -408,7 +428,7 @@ extern void FVBReplaceOutlineWithReference( FontViewBase *fv, double fudge );
extern void FVCorrectReferences(FontViewBase *fv);
extern void _FVSimplify(FontViewBase *fv,struct simplifyinfo *smpl);
extern void UnlinkThisReference(FontViewBase *fv,SplineChar *sc,int layer);
extern FontViewBase *ViewPostscriptFont(char *filename,int openflags);
extern FontViewBase *ViewPostScriptFont(char *filename,int openflags);
extern void FVBuildAccent(FontViewBase *fv,int onlyaccents);
extern void FVRemoveKerns(FontViewBase *fv);
extern void FVRemoveVKerns(FontViewBase *fv);
@ -430,13 +450,16 @@ extern void BCTrans(BDFFont *bdf,BDFChar *bc,BVTFunc *bvts,FontViewBase *fv );
extern void BCSetPoint(BDFChar *bc, int x, int y, int color);
extern void BCTransFunc(BDFChar *bc,enum bvtools type,int xoff,int yoff);
extern void skewselect(BVTFunc *bvtf,real t);
extern void BCExpandBitmapToEmBox(BDFChar *bc, int xmin, int ymin, int xmax, int ymax);
extern BDFFloat *BDFFloatCreate(BDFChar *bc,int xmin,int xmax,int ymin,int ymax, int clear);
extern BDFFloat *BDFFloatCopy(BDFFloat *sel);
extern BDFFloat *BDFFloatConvert(BDFFloat *sel,int newdepth, int olddepth);
extern void BDFFloatFree(BDFFloat *sel);
extern void BCMergeReferences(BDFChar *base,BDFChar *cur,int8 xoff,int8 yoff);
extern BDFChar *BDFGetMergedChar(BDFChar *bc) ;
extern void BCUnlinkThisReference(struct fontviewbase *fv,BDFChar *bc);
extern int CVLayer(CharViewBase *cv);
extern Undoes *CVPreserveStateHints(CharViewBase *cv);
extern Undoes *CVPreserveState(CharViewBase *cv);
@ -452,7 +475,7 @@ extern void CopySelected(CharViewBase *cv,int doanchors);
extern void CVCopyGridFit(CharViewBase *cv);
extern void CopyWidth(CharViewBase *cv,enum undotype);
extern void PasteToCV(CharViewBase *cv);
extern void CVYPerspective(CharViewBase *cv,double x_vanish, double y_vanish);
extern void CVYPerspective(CharViewBase *cv,bigreal x_vanish, bigreal y_vanish);
extern void ScriptSCEmbolden(SplineChar *sc,int layer,enum embolden_type type,struct lcg_zones *zones);
extern void CVEmbolden(CharViewBase *cv,enum embolden_type type,struct lcg_zones *zones);
extern void SCCondenseExtend(struct counterinfo *ci,SplineChar *sc, int layer,
@ -566,4 +589,28 @@ extern void FVRevertBackup(FontViewBase *fv);
extern void FVRevertGlyph(FontViewBase *fv);
extern int MMReblend(FontViewBase *fv, MMSet *mm);
extern FontViewBase *MMCreateBlendedFont(MMSet *mm,FontViewBase *fv,real blends[MmMax],int tonew );
extern void FVB_MakeNamelist(FontViewBase *fv, FILE *file);
extern void AutoWidth2(FontViewBase *fv,int separation,int min_side,int max_side,
int chunk_height, int loop_cnt);
extern void GuessOpticalOffset(SplineChar *sc,int layer,real *_loff, real *_roff,
int chunk_height );
extern void AutoKern2(SplineFont *sf, int layer,SplineChar **left,SplineChar **right,
struct lookup_subtable *into,
int separation, int min_kern, int from_closest_approach, int only_closer,
int chunk_height,
void (*addkp)(void *data,SplineChar *left,SplineChar *r,int off),
void *data);
extern void AutoKern2NewClass(SplineFont *sf,int layer,char **leftnames, char **rightnames,
int lcnt, int rcnt,
void (*kcAddOffset)(void *data,int left_index, int right_index,int offset), void *data,
int separation, int min_kern, int from_closest_approach, int only_closer,
int chunk_height);
extern void AutoKern2BuildClasses(SplineFont *sf,int layer,
SplineChar **leftglyphs,SplineChar **rightglyphs,
struct lookup_subtable *sub,
int separation, int min_kern, int touching, int only_closer,
int autokern,
real good_enough);
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -26,7 +26,7 @@
*/
/* Routines to handle bdf properties, and a dialog to set them */
#include "pfaeditui.h"
#include "fontforgeui.h"
#include "splinefont.h"
#include <string.h>
#include <ustring.h>
@ -34,6 +34,10 @@
#include <math.h>
#include <gkeysym.h>
extern GBox _ggadget_Default_Box;
#define ACTIVE_BORDER (_ggadget_Default_Box.active_border)
#define MAIN_FOREGROUND (_ggadget_Default_Box.main_foreground)
struct bdf_dlg_font {
int old_prop_cnt;
BDFProperties *old_props;
@ -482,6 +486,7 @@ static void BdfP_Expose(struct bdf_dlg *bd, GWindow pixmap) {
int page = bd->vheight/(bd->fh+1);
GRect clip, old, r;
char buffer[40];
extern GBox _ggadget_Default_Box;
GDrawSetFont(pixmap,bd->font);
clip.x = 4; clip.width = bd->value_x-4-2; clip.height = bd->fh;
@ -491,22 +496,22 @@ static void BdfP_Expose(struct bdf_dlg *bd, GWindow pixmap) {
if ( sel ) {
r.x = 0; r.width = bd->width;
r.y = clip.y; r.height = clip.height;
GDrawFillRect(pixmap,&r,0xffff00);
GDrawFillRect(pixmap,&r,ACTIVE_BORDER);
}
GDrawPushClip(pixmap,&clip,&old);
GDrawDrawBiText8(pixmap,4,i*(bd->fh+1)+bd->as,bdf->props[i+cur->top_prop].name,-1,NULL,0x000000);
GDrawDrawBiText8(pixmap,4,i*(bd->fh+1)+bd->as,bdf->props[i+cur->top_prop].name,-1,NULL,MAIN_FOREGROUND);
GDrawPopClip(pixmap,&old);
switch ( bdf->props[i+cur->top_prop].type&~prt_property ) {
case prt_string: case prt_atom:
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,bdf->props[i+cur->top_prop].u.str,-1,NULL,0x000000);
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,bdf->props[i+cur->top_prop].u.str,-1,NULL,MAIN_FOREGROUND);
break;
case prt_int:
sprintf( buffer, "%d", bdf->props[i+cur->top_prop].u.val );
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,buffer,-1,NULL,0x000000);
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,buffer,-1,NULL,MAIN_FOREGROUND);
break;
case prt_uint:
sprintf( buffer, "%u", (unsigned) bdf->props[i+cur->top_prop].u.val );
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,buffer,-1,NULL,0x000000);
GDrawDrawBiText8(pixmap,bd->value_x+2,i*(bd->fh+1)+bd->as,buffer,-1,NULL,MAIN_FOREGROUND);
break;
}
GDrawDrawLine(pixmap,0,i*(bd->fh+1)+bd->fh,bd->vwidth,i*(bd->fh+1)+bd->fh,0x808080);
@ -529,9 +534,9 @@ static void BdfP_Expose(struct bdf_dlg *bd, GWindow pixmap) {
/* GT: a translator may need to ask me to disambiguate more strings. Please do so: */
/* GT: <pfaedit@users.sourceforge.net> */
GDrawDrawBiText8(pixmap,4,i*(bd->fh+1)+bd->as,S_("Property|New..."),-1,NULL,0xff0000);
GDrawDrawLine(pixmap,0,i*(bd->fh+1)+bd->fh,bd->vwidth,i*(bd->fh+1)+bd->fh,0x808080);
GDrawDrawLine(pixmap,0,i*(bd->fh+1)+bd->fh,bd->vwidth,i*(bd->fh+1)+bd->fh, _ggadget_Default_Box.border_darker);
}
GDrawDrawLine(pixmap,bd->value_x,0,bd->value_x,bd->vheight,0x808080);
GDrawDrawLine(pixmap,bd->value_x,0,bd->value_x,bd->vheight, _ggadget_Default_Box.border_darker);
}
static void BdfP_Invoked(GWindow v, GMenuItem *mi, GEvent *e) {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -952,12 +952,21 @@ return( BDFMakeGID(bdf,map->map[enc]));
}
void BCClearAll(BDFChar *bc) {
BDFRefChar *head,*cur;
if ( bc==NULL )
return;
for ( head = bc->refs; head != NULL; ) {
cur = head; head = head->next; free( cur );
}
bc->refs = NULL;
BCPreserveState(bc);
BCFlattenFloat(bc);
memset(bc->bitmap,'\0',bc->bytes_per_line*(bc->ymax-bc->ymin+1));
BCCompressBitmap(bc);
bc->xmin = 0; bc->xmax = 0;
bc->ymin = 0; bc->ymax = 0;
BCCharChangedUpdate(bc);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -29,7 +29,6 @@
#include <math.h>
#include "bitmapcontrol.h"
int autohint_before_rasterize = 1;
int bdfcontrol_lastwhich = bd_selected;
static void RemoveBDFWindows(BDFFont *bdf) {
@ -105,7 +104,7 @@ static void SFFigureBitmaps(SplineFont *sf,int32 *sizes,int usefreetype,int rast
first = true;
for ( i=0; sizes[i]!=0 ; ++i ) if ( sizes[i]>0 ) {
if ( first && autohint_before_rasterize )
if ( first && autohint_before_generate )
SplineFontAutoHint(sf,layer);
if ( first && usefreetype )
freetypecontext = FreeTypeFontContext(sf,NULL,NULL,layer);
@ -187,7 +186,7 @@ return;
else if ( usefreetype )
bdfc = SplineCharFreeTypeRasterizeNoHints(sf->glyphs[gid],layer,bdf->pixelsize,72,BDFDepth(bdf));
if ( bdfc==NULL ) {
if ( autohint_before_rasterize &&
if ( autohint_before_generate &&
sf->glyphs[gid]->changedsincelasthinted &&
!sf->glyphs[gid]->manualhints )
SplineCharAutoHint(sf->glyphs[gid],layer,NULL);
@ -209,7 +208,7 @@ return;
}
static int FVRegenBitmaps(CreateBitmapData *bd,int32 *sizes,int usefreetype) {
FontViewBase *fv = bd->fv;
FontViewBase *fv = bd->fv, *selfv = bd->which==bd_all ? NULL : fv;
SplineFont *sf = bd->sf, *subsf, *bdfsf = sf->cidmaster!=NULL ? sf->cidmaster : sf;
int i,j;
BDFFont *bdf;
@ -227,7 +226,7 @@ return( false );
}
if ( bd->which==bd_current && bd->sc!=NULL ) {
if ( usefreetype )
freetypecontext = FreeTypeFontContext(bd->sc->parent,bd->sc, fv,bd->layer);
freetypecontext = FreeTypeFontContext(bd->sc->parent,bd->sc, selfv,bd->layer);
ReplaceBDFC(bd->sc->parent,sizes,bd->sc->orig_pos,freetypecontext,usefreetype,bd->layer);
if ( freetypecontext )
FreeTypeFreeContext(freetypecontext);
@ -238,7 +237,7 @@ return( false );
for ( i=0; i<subsf->glyphcnt; ++i ) {
if ( SCWorthOutputting(subsf->glyphs[i])) {
if ( usefreetype && freetypecontext==NULL )
freetypecontext = FreeTypeFontContext(subsf,NULL, fv, bd->layer);
freetypecontext = FreeTypeFontContext(subsf,NULL, selfv, bd->layer);
ReplaceBDFC(subsf,sizes,i,freetypecontext,usefreetype, bd->layer);
}
}
@ -250,7 +249,7 @@ return( false );
for ( i=0; i<fv->map->enccount; ++i ) {
if ( fv->selected[i] || bd->which == bd_all ) {
if ( usefreetype && freetypecontext==NULL )
freetypecontext = FreeTypeFontContext(sf,NULL, fv, bd->layer);
freetypecontext = FreeTypeFontContext(sf,NULL, selfv, bd->layer);
ReplaceBDFC(sf,sizes,fv->map->map[i],freetypecontext,usefreetype, bd->layer);
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include "gwidget.h"
#include "ustring.h"
#include <gkeysym.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <gkeysym.h>
#include <utype.h>
#include <ustring.h>
@ -137,6 +137,7 @@ static void BC_CharChangedUpdate(BDFChar *bc) {
BitmapView *bv;
int waschanged = bc->changed;
FontView *fv;
struct bdfcharlist *dlist;
bc->changed = true;
for ( bv = bc->views; bv!=NULL; bv=bv->next ) {
@ -154,6 +155,8 @@ static void BC_CharChangedUpdate(BDFChar *bc) {
FVToggleCharChanged(fv->b.sf->glyphs[bc->orig_pos]);
}
}
for ( dlist=bc->dependents; dlist!=NULL; dlist=dlist->next )
BC_CharChangedUpdate(dlist->bc);
}
static char *BVMakeTitles(BitmapView *bv, BDFChar *bc,char *buf) {
@ -229,6 +232,8 @@ static void BVHScroll(BitmapView *bv,struct sbevent *sb);
static void BVVScroll(BitmapView *bv,struct sbevent *sb);
void BVChar(BitmapView *bv, GEvent *event ) {
BDFRefChar *head;
extern int navigation_mask;
#if _ModKeysAutoRepeat
/* Under cygwin these keys auto repeat, they don't under normal X */
@ -292,21 +297,30 @@ return;
if ( bv->bc->selection==NULL ) {
bv->bc->xmin += xoff; bv->bc->xmax += xoff;
bv->bc->ymin += yoff; bv->bc->ymax += yoff;
for ( head=bv->bc->refs; head!=NULL; head=head->next ) {
if ( head->selected ) {
head->xoff += xoff;
head->yoff += yoff;
}
}
} else {
bv->bc->selection->xmin += xoff; bv->bc->selection->xmax += xoff;
bv->bc->selection->ymin += yoff; bv->bc->selection->ymax += yoff;
bv->bc->selection->xmin += xoff;
bv->bc->selection->xmax += xoff;
bv->bc->selection->ymin += yoff;
bv->bc->selection->ymax += yoff;
}
BCCharChangedUpdate(bv->bc);
}
} else if ( !(event->u.chr.state&(ksm_control|ksm_meta)) &&
} else if ( (event->u.chr.state&((GMenuMask()|navigation_mask)&~(ksm_shift|ksm_capslock)))==navigation_mask &&
event->type == et_char &&
event->u.chr.chars[0]!='\0' && event->u.chr.chars[1]=='\0' ) {
event->u.chr.keysym!=0 &&
(event->u.chr.keysym<GK_Special /*|| event->u.chr.keysym>=0x10000*/)) {
SplineFont *sf = bv->bc->sc->parent;
int i;
EncMap *map = bv->fv->b.map;
extern int cv_auto_goto;
if ( cv_auto_goto ) {
i = SFFindSlot(sf,map,event->u.chr.chars[0],NULL);
i = SFFindSlot(sf,map,event->u.chr.keysym,NULL);
if ( i!=-1 )
BVChangeChar(bv,i,false);
}
@ -363,6 +377,48 @@ static void BVDrawTempPoint(BitmapView *bv,int x, int y,void *pixmap) {
GDrawSetStippled(pixmap,0, 0,0);
}
static void BVDrawRefBorder(BitmapView *bv, BDFChar *bc, GWindow pixmap,
uint8 selected, int8 xoff, int8 yoff) {
int i, j;
int isblack, lw, rw, tw, bw;
int tx, ty;
Color outcolor = selected ? 0x606000 : 0x606060;
for ( i=bc->ymax-bc->ymin; i>=0; --i ) {
for ( j=0; j<=bc->xmax-bc->xmin; ++j ) {
tx = bv->xoff + (bc->xmin + xoff +j)*bv->scale;
ty = bv->height-bv->yoff - (bc->ymax + yoff - i)*bv->scale;
isblack = ( !bc->byte_data &&
( bc->bitmap[i*bc->bytes_per_line+(j>>3)] & (1<<(7-(j&7))))) ||
( bc->byte_data && bc->bitmap[i*bc->bytes_per_line+j] != 0 );
if ( !isblack )
continue;
lw = ( j == 0 || ( !bc->byte_data &&
!( bc->bitmap[i*bc->bytes_per_line+((j-1)>>3)] & (1<<(7-((j-1)&7))))) ||
( bc->byte_data && bc->bitmap[i*bc->bytes_per_line+j-1] == 0 ));
rw = ( j == bc->xmax-bc->xmin || ( !bc->byte_data &&
!( bc->bitmap[i*bc->bytes_per_line+((j+1)>>3)] & (1<<(7-((j+1)&7))))) ||
( bc->byte_data && bc->bitmap[i*bc->bytes_per_line+j+1] == 0 ));
tw = ( i == bc->ymax-bc->ymin || ( !bc->byte_data &&
!( bc->bitmap[(i+1)*bc->bytes_per_line+(j>>3)] & (1<<(7-(j&7))))) ||
( bc->byte_data && bc->bitmap[(i+1)*bc->bytes_per_line+j] == 0 ));
bw = ( i == 0 || ( !bc->byte_data &&
!( bc->bitmap[(i-1)*bc->bytes_per_line+(j>>3)] & (1<<(7-(j&7))))) ||
( bc->byte_data && bc->bitmap[(i-1)*bc->bytes_per_line+j] == 0 ));
if ( lw )
GDrawDrawLine(pixmap,tx+1,ty, tx+1,ty-bv->scale,outcolor);
if ( rw )
GDrawDrawLine(pixmap,tx+bv->scale-1,ty, tx+bv->scale-1,ty-bv->scale,outcolor);
if ( tw )
GDrawDrawLine(pixmap,tx,ty-1, tx+bv->scale,ty-1,outcolor);
if ( bw )
GDrawDrawLine(pixmap,tx,ty-bv->scale+1, tx+bv->scale,ty-bv->scale+1,outcolor);
}
}
}
static void BVDrawSelection(BitmapView *bv,void *pixmap) {
GRect pixel, rect;
BDFFloat *sel = bv->bc->selection;
@ -541,7 +597,7 @@ void BCGeneralFunction(BitmapView *bv,
CirclePoints(bv,x,y,ox,oy,modx,mody,SetPoint,data);
}
if ( bv->active_tool==bvt_elipse ) {
/* there may be quite a gap between the the two semi-circles */
/* there may be quite a gap between the two semi-circles */
/* because the tangent is nearly vertical here. So just fill */
/* it in */
int j;
@ -555,14 +611,92 @@ void BCGeneralFunction(BitmapView *bv,
}
}
static void BVDrawRefName(BitmapView *bv,GWindow pixmap,BDFRefChar *ref,int fg) {
int x,y, len;
GRect size;
char *refinfo;
IBounds bb;
refinfo = galloc(strlen(ref->bdfc->sc->name) + 30);
sprintf(refinfo,"%s XOff: %d YOff: %d", ref->bdfc->sc->name, ref->xoff, ref->yoff);
bb.minx = ref->bdfc->xmin + ref->xoff;
bb.maxx = ref->bdfc->xmax + ref->xoff;
bb.miny = ref->bdfc->ymin + ref->yoff;
bb.maxy = ref->bdfc->ymax + ref->yoff;
BDFCharQuickBounds(ref->bdfc,&bb,ref->xoff,ref->yoff,false,true);
x = bv->xoff + (bb.minx)*bv->scale;
y = bv->height - bv->yoff - (bb.maxy + 1)*bv->scale;
y -= 5;
if ( x<-400 || y<-40 || x>bv->width+400 || y>bv->height )
return;
if ( GDrawHasCairo(pixmap)&gc_pango ) {
GDrawLayoutInit(pixmap,refinfo,-1,bv->small);
GDrawLayoutExtents(pixmap,&size);
GDrawLayoutDraw(pixmap,x-size.width/2,y,fg);
len = size.width;
} else {
GDrawSetFont(pixmap,bv->small);
len = GDrawGetBiText8Width(pixmap,refinfo,-1,-1,NULL);
GDrawDrawBiText8(pixmap,x-len/2,y,refinfo,-1,NULL,fg);
}
free(refinfo);
}
static void BVDrawGlyph(BitmapView *bv, BDFChar *bc, GWindow pixmap, GRect *pixel,
uint8 is_ref, uint8 selected, int8 xoff, int8 yoff) {
int i, j;
int color = 0x808080;
BDFFont *bdf = bv->bdf;
BDFRefChar *cur;
if ( is_ref && !selected )
GDrawSetStippled(pixmap,1, 0,0);
for ( i=bc->ymax-bc->ymin; i>=0; --i ) {
for ( j=0; j<=bc->xmax-bc->xmin; ++j ) {
pixel->x = bv->xoff + (bc->xmin + xoff +j)*bv->scale;
pixel->y = bv->height-bv->yoff - (bc->ymax + yoff - i + 1)*bv->scale;
if ( bdf->clut==NULL ) {
if ( bc->bitmap[i*bc->bytes_per_line+(j>>3)] & (1<<(7-(j&7))) ) {
GDrawFillRect(pixmap,pixel,color);
if ( selected ) {
GDrawSetStippled(pixmap,2, 0,0);
GDrawFillRect(pixmap,pixel,0x909000);
GDrawSetStippled(pixmap,0, 0,0);
}
}
} else {
int index = bc->bitmap[i*bc->bytes_per_line+j];
if ( index!=0 ) {
GDrawFillRect(pixmap,pixel,bdf->clut->clut[index]);
if ( selected ) {
GDrawSetStippled(pixmap,2, 0,0);
GDrawFillRect(pixmap,pixel,0x909000);
GDrawSetStippled(pixmap,0, 0,0);
}
}
}
}
}
if ( is_ref ) {
GDrawSetStippled(pixmap,0, 0,0);
BVDrawRefBorder( bv,bc,pixmap,selected,xoff,yoff );
}
for ( cur=bc->refs; cur!=NULL; cur=cur->next ) if ( cur->bdfc != NULL ) {
BVDrawGlyph( bv,cur->bdfc,pixmap,pixel,true,(cur->selected | selected),
xoff+cur->xoff,yoff+cur->yoff );
}
}
static void BVExpose(BitmapView *bv, GWindow pixmap, GEvent *event ) {
CharView cvtemp;
GRect old;
DRect clip;
int i,j;
int i;
GRect pixel;
BDFChar *bc = bv->bc;
BDFFont *bdf = bv->bdf;
BDFRefChar *bref;
RefChar *refs;
extern Color widthcol;
@ -572,25 +706,14 @@ static void BVExpose(BitmapView *bv, GWindow pixmap, GEvent *event ) {
/* fore ground is a misnomer. it's what we're interested in but we */
/* actually need to draw it first, otherwise it obscures everything */
pixel.width = pixel.height = bv->scale+1;
for ( i=bc->ymax-bc->ymin; i>=0; --i ) {
for ( j=0; j<=bc->xmax-bc->xmin; ++j ) {
pixel.x = bv->xoff + (bc->xmin+j)*bv->scale;
pixel.y = bv->height-bv->yoff-(bc->ymax-i+1)*bv->scale;
if ( bdf->clut==NULL ) {
if ( bc->bitmap[i*bc->bytes_per_line+(j>>3)] & (1<<(7-(j&7))) )
GDrawFillRect(pixmap,&pixel,0x808080);
} else {
int index = bc->bitmap[i*bc->bytes_per_line+j];
if ( index!=0 )
GDrawFillRect(pixmap,&pixel,bdf->clut->clut[index]);
}
}
}
BVDrawGlyph( bv,bc,pixmap,&pixel,false,false,0,0 );
if ( bv->active_tool!=bvt_none ) {
/* This does nothing for many tools, but for lines, rects and circles */
/* it draws temporary points */
BCGeneralFunction(bv,BVDrawTempPoint,pixmap);
}
/* Selected references are handled in BVDrawGlyph() */
if ( bv->bc->selection )
BVDrawSelection(bv,pixmap);
}
@ -616,6 +739,11 @@ static void BVExpose(BitmapView *bv, GWindow pixmap, GEvent *event ) {
GDrawDrawLine(pixmap,0,-bv->yoff+bv->height-(bv->bdf->ascent-bc->vwidth)*bv->scale,
bv->width,-bv->yoff+bv->height-(bv->bdf->ascent-bc->vwidth)*bv->scale,widthcol);
}
if ( bv->showfore ) {
/* Reference names are drawn after grid (otherwise some characters may get unreadable */
for ( bref=bc->refs; bref!=NULL; bref=bref->next )
BVDrawRefName( bv,pixmap,bref,0 );
}
if ( bv->showoutline ) {
Color col = (view_bgcol<0x808080)
? (bv->bc->byte_data ? 0x008800 : 0x004400 )
@ -686,7 +814,7 @@ static void BVMainExpose(BitmapView *bv, GWindow pixmap, GEvent *event ) {
GImage gi;
struct _GImage base;
GClut clut;
BDFChar *bdfc = bv->bc;
BDFChar *bdfc = BDFGetMergedChar( bv->bc );
temp = event->u.expose.rect;
if ( temp.y+temp.height < bv->mbh )
@ -742,6 +870,7 @@ return;
LogoExpose(pixmap,event,&r,dm_fore);
GDrawPopClip(pixmap,&old);
BDFCharFree( bdfc );
}
static void BVShowInfo(BitmapView *bv) {
@ -898,8 +1027,8 @@ static void BVSetWidth(BitmapView *bv, int x) {
BDFFont *bdf;
BDFChar *bc = bv->bc;
bc->width = x;
if ( bv->bdf->sf->onlybitmaps ) {
bc->width = x;
tot=0; cnt=0;
for ( bdf = bv->bdf->sf->bitmaps; bdf!=NULL; bdf=bdf->next )
if ( bdf->glyphs[bc->orig_pos]) {
@ -910,8 +1039,8 @@ static void BVSetWidth(BitmapView *bv, int x) {
bc->sc->width = tot/cnt;
bc->sc->widthset = true;
}
BCCharChangedUpdate(bc);
}
BCCharChangedUpdate(bc);
}
static void BVSetVWidth(BitmapView *bv, int y) {
@ -919,20 +1048,22 @@ static void BVSetVWidth(BitmapView *bv, int y) {
BDFFont *bdf;
BDFChar *bc = bv->bc;
if ( bv->bdf->sf->onlybitmaps && bv->bdf->sf->hasvmetrics ) {
bc->vwidth = bv->bdf->ascent-y;
if ( !bv->bdf->sf->hasvmetrics )
return;
bc->vwidth = bv->bdf->ascent-y;
if ( bv->bdf->sf->onlybitmaps ) {
tot=0; cnt=0;
for ( bdf = bv->bdf->sf->bitmaps; bdf!=NULL; bdf=bdf->next )
if ( bdf->glyphs[bc->orig_pos]) {
tot += bdf->glyphs[bc->orig_pos]->vwidth*1000/(bdf->ascent+bdf->descent);
++cnt;
}
if ( cnt!=0 ) {
if ( cnt!=0 && bv->bdf->sf->onlybitmaps ) {
bc->sc->vwidth = tot/cnt;
bc->sc->widthset = true;
}
BCCharChangedUpdate(bc);
}
BCCharChangedUpdate(bc);
}
int BVColor(BitmapView *bv) {
@ -940,6 +1071,31 @@ int BVColor(BitmapView *bv) {
return ( (bv->color+div/2)/div );
}
static int IsReferenceTouched(BitmapView *bv, BDFRefChar *ref, int x, int y){
BDFRefChar *head;
BDFChar *rbc;
int nx, ny;
if ( ref == NULL )
return( false );
rbc = ref->bdfc;
ny = rbc->ymax - y + ref->yoff;
nx = x - rbc->xmin - ref->xoff;
if (nx>=0 && nx<=( rbc->xmax - rbc->xmin ) &&
ny>=0 && ny<=( rbc->ymax - rbc->ymin ) &&
(( rbc->byte_data && rbc->bitmap[ny*rbc->bytes_per_line+nx] != 0 ) ||
(( !rbc->byte_data &&
rbc->bitmap[ny*rbc->bytes_per_line + (nx>>3)] & (1<<(7 - (nx&7)))))))
return( true );
for ( head = rbc->refs; head != NULL; head = head->next ) {
if ( IsReferenceTouched( bv,head,x,y))
return( true );
}
return( false );
}
static void BVMouseDown(BitmapView *bv, GEvent *event) {
int x = floor( (event->u.mouse.x-bv->xoff)/ (real) bv->scale);
int y = floor( (bv->height-event->u.mouse.y-bv->yoff)/ (real) bv->scale);
@ -947,6 +1103,7 @@ static void BVMouseDown(BitmapView *bv, GEvent *event) {
BDFChar *bc = bv->bc;
BDFFloat *sel;
int color_under_cursor;
BDFRefChar *refsel = NULL, *head;
if ( event->u.mouse.button==2 && event->u.mouse.device!=NULL &&
strcmp(event->u.mouse.device,"stylus")==0 )
@ -972,6 +1129,10 @@ return;
BVPaletteColorUnderChange(bv,color_under_cursor);
bv->event_x = event->u.mouse.x; bv->event_y = event->u.mouse.y;
bv->recentchange = false;
for ( head = bc->refs; head != NULL; head = head->next ) {
if ( IsReferenceTouched( bv,head,x,y ))
refsel = head;
}
switch ( bv->active_tool ) {
case bvt_eyedropper:
bv->color = color_under_cursor;
@ -986,8 +1147,8 @@ return;
ny>=0 && ny<=bc->ymax-bc->ymin ) {
int nx = x-bc->xmin;
if ( bc->bitmap[ny*bc->bytes_per_line + (nx>>3)] &
(1<<(7-(nx&7))) )
bv->clearing = true;
(1<<(7-(nx&7))) )
bv->clearing = true;
}
BCPreserveState(bc);
BCFlattenFloat(bc);
@ -1001,19 +1162,28 @@ return;
BCCharChangedUpdate(bc);
break;
case bvt_pointer:
if ( (sel = bc->selection)!=NULL ) {
if ( !( event->u.mouse.state&ksm_shift )) {
for ( head = bc->refs; head != NULL; head=head->next )
head->selected = false;
}
if ( refsel != NULL ) {
BCFlattenFloat(bc);
refsel->selected = ( event->u.mouse.state&ksm_shift ) ?
!(refsel->selected) : true;
GDrawSetCursor(bv->v,ct_shift);
} else if ( (sel = bc->selection)!=NULL ) {
if ( x<sel->xmin || x>sel->xmax || y<sel->ymin || y>sel->ymax )
BCFlattenFloat(bc);
else {
GDrawSetCursor(bv->v,ct_shift);
/* otherwise we'll move the selection */
}
} else if ( bc->sc->parent->onlybitmaps &&
} else if ( /*bc->sc->parent->onlybitmaps &&*/
event->u.mouse.x-bv->xoff > bc->width*bv->scale-3 &&
event->u.mouse.x-bv->xoff < bc->width*bv->scale+3 ) {
bv->active_tool = bvt_setwidth;
BVToolsSetCursor(bv,event->u.mouse.state|(1<<(7+event->u.mouse.button)), event->u.mouse.device );
} else if ( bc->sc->parent->onlybitmaps && bc->sc->parent->hasvmetrics &&
} else if ( /*bc->sc->parent->onlybitmaps &&*/ bc->sc->parent->hasvmetrics &&
bv->height-event->u.mouse.y-bv->yoff > (bv->bdf->ascent-bc->vwidth)*bv->scale-3 &&
bv->height-event->u.mouse.y-bv->yoff < (bv->bdf->ascent-bc->vwidth)*bv->scale+3 ) {
bv->active_tool = bvt_setvwidth;
@ -1036,7 +1206,8 @@ static void BVMouseMove(BitmapView *bv, GEvent *event) {
int newx, newy;
int fh = bv->bdf->ascent+bv->bdf->descent;
BDFChar *bc = bv->bc;
int color_under_cursor, ny;
int color_under_cursor, ny, has_selected_refs = false;
BDFRefChar *head;
bv->info_x = x; bv->info_y = y;
ny = bc->ymax-y;
@ -1090,21 +1261,40 @@ return; /* Not pressed */
bc->xmax += x-bv->pressed_x;
bc->ymin += y-bv->pressed_y;
bc->ymax += y-bv->pressed_y;
for ( head=bc->refs; head!=NULL; head=head->next ) {
if ( head->selected ) {
head->xoff += x-bv->pressed_x;
head->yoff += y-bv->pressed_y;
}
}
BCCharChangedUpdate(bc);
bv->pressed_x = x; bv->pressed_y = y;
}
break;
case bvt_pointer:
if ( bc->selection!=NULL ) {
for ( head=bc->refs; head!=NULL && !has_selected_refs; head=head->next ) {
if ( head->selected ) has_selected_refs = true;
}
if ( bc->selection!=NULL || has_selected_refs ) {
if ( x!=bv->pressed_x || y!=bv->pressed_y ) {
if ( !bv->recentchange ) {
BCPreserveState(bc);
bv->recentchange = true;
}
bc->selection->xmin += x-bv->pressed_x;
bc->selection->xmax += x-bv->pressed_x;
bc->selection->ymin += y-bv->pressed_y;
bc->selection->ymax += y-bv->pressed_y;
if ( has_selected_refs ) {
for ( head=bc->refs; head!=NULL; head=head->next ) {
if ( head->selected ) {
head->xoff += x-bv->pressed_x;
head->yoff += y-bv->pressed_y;
}
}
} else if ( bc->selection != NULL ) {
bc->selection->xmin += x-bv->pressed_x;
bc->selection->xmax += x-bv->pressed_x;
bc->selection->ymin += y-bv->pressed_y;
bc->selection->ymax += y-bv->pressed_y;
}
BCCharChangedUpdate(bc);
bv->pressed_x = x; bv->pressed_y = y;
}
@ -1130,17 +1320,24 @@ static void BVMagnify(BitmapView *bv, int midx, int midy, int bigger);
static void BVMouseUp(BitmapView *bv, GEvent *event) {
int x = floor( (event->u.mouse.x-bv->xoff)/ (real) bv->scale);
int y = floor( (bv->height-event->u.mouse.y-bv->yoff)/ (real) bv->scale);
BDFRefChar *refsel = NULL, *head;
BVMouseMove(bv,event);
for ( head = bv->bc->refs; head != NULL; head = head->next ) {
if ( IsReferenceTouched( bv,head,x,y ))
refsel = head;
}
switch ( bv->active_tool ) {
case bvt_magnify: case bvt_minify:
BVMagnify(bv,x,y,bv->active_tool==bvt_magnify?1:-1);
break;
case bvt_line: case bvt_rect: case bvt_filledrect:
case bvt_elipse: case bvt_filledelipse:
BCGeneralFunction(bv,BVSetPoint,NULL);
bv->active_tool = bvt_none;
BCCharChangedUpdate(bv->bc);
if ( refsel == NULL ) {
BCGeneralFunction(bv,BVSetPoint,NULL);
bv->active_tool = bvt_none;
BCCharChangedUpdate(bv->bc);
}
break;
case bvt_pointer:
if ( bv->bc->selection!=NULL ) {
@ -1150,6 +1347,10 @@ static void BVMouseUp(BitmapView *bv, GEvent *event) {
BCFlattenFloat(bv->bc);
BCCharChangedUpdate(bv->bc);
}
} else if ( refsel ) {
GDrawSetCursor(bv->v,ct_mypointer);
bv->active_tool = bvt_none;
BCCharChangedUpdate(bv->bc);
} else {
int dx,dy;
if ( (dx = event->u.mouse.x-bv->event_x)<0 ) dx = -dx;
@ -1177,8 +1378,12 @@ static int v_e_h(GWindow gw, GEvent *event) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button==4 || event->u.mouse.button==5) ) {
if ( !(event->u.mouse.state&(ksm_shift|ksm_control)) ) /* bind shift to magnify/minify */
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) {
int ish = event->u.mouse.button>5;
if ( event->u.mouse.state&ksm_shift ) ish = !ish;
if ( ish ) /* bind shift to vertical scrolling */
return( GGadgetDispatchEvent(bv->hsb,event));
else
return( GGadgetDispatchEvent(bv->vsb,event));
}
@ -1233,7 +1438,12 @@ static int bv_e_h(GWindow gw, GEvent *event) {
int enc;
if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button==4 || event->u.mouse.button==5) ) {
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) {
int ish = event->u.mouse.button>5;
if ( event->u.mouse.state&ksm_shift ) ish = !ish;
if ( ish ) /* bind shift to vertical scrolling */
return( GGadgetDispatchEvent(bv->hsb,event));
else
return( GGadgetDispatchEvent(bv->vsb,event));
}
@ -1281,7 +1491,7 @@ return( GGadgetDispatchEvent(bv->vsb,event));
BVPaletteActivate(bv);
break;
case et_mousemove:
enc = BVCurEnc(bv);
enc = BVCurEnc(bv);
SCPreparePopup(bv->gw,bv->bc->sc,bv->fv->b.map->remap,enc,
UniFromEnc(enc,bv->fv->b.map->enc));
break;
@ -1309,6 +1519,8 @@ return( true );
#define MID_Paste 2103
#define MID_Clear 2104
#define MID_SelAll 2106
#define MID_CopyRef 2107
#define MID_UnlinkRef 2108
#define MID_Undo 2109
#define MID_Redo 2110
#define MID_RemoveUndoes 2111
@ -1358,7 +1570,12 @@ static void BVMenuGenerate(GWindow gw,struct gmenuitem *mi,GEvent *g) {
static void BVMenuGenerateFamily(GWindow gw,struct gmenuitem *mi,GEvent *g) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
_FVMenuGenerate(bv->fv,true);
_FVMenuGenerate(bv->fv,gf_macfamily);
}
static void BVMenuGenerateTTC(GWindow gw,struct gmenuitem *mi,GEvent *g) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
_FVMenuGenerate(bv->fv,gf_ttc);
}
static void BVMenuExport(GWindow gw,struct gmenuitem *mi,GEvent *g) {
@ -1481,7 +1698,7 @@ static void BVMenuChangePixelSize(GWindow gw,struct gmenuitem *mi,GEvent *g) {
static void BVMenuGotoChar(GWindow gw,struct gmenuitem *mi,GEvent *g) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
int pos = GotoChar(bv->fv->b.sf,bv->fv->b.map);
int pos = GotoChar(bv->fv->b.sf,bv->fv->b.map,NULL);
if ( pos!=-1 )
BVChangeChar(bv,pos,false);
@ -1574,6 +1791,32 @@ return;
BCDoRedo(bv->bc);
}
static void _BVUnlinkRef(BitmapView *bv) {
int anyrefs = false;
BDFRefChar *ref, *next, *prev = NULL;
if ( bv->bc->refs!=NULL ) {
BCPreserveState(bv->bc);
for ( ref=bv->bc->refs; ref!=NULL && !anyrefs; ref=ref->next )
if ( ref->selected ) anyrefs = true;
for ( ref=bv->bc->refs; ref!=NULL ; ref=next ) {
next = ref->next;
if ( ref->selected || !anyrefs) {
BCPasteInto( bv->bc,ref->bdfc,ref->xoff,ref->yoff,false,false );
BCMergeReferences( bv->bc,ref->bdfc,ref->xoff,ref->yoff );
BCRemoveDependent( bv->bc,ref );
} else
prev = ref;
}
BCCharChangedUpdate(bv->bc);
}
}
static void BVUnlinkRef(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
_BVUnlinkRef(bv);
}
static void BVRemoveUndoes(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
UndoesFree(bv->bc->undoes); bv->bc->undoes = NULL;
@ -1585,12 +1828,34 @@ static void BVCopy(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BCCopySelected(bv->bc,bv->bdf->pixelsize,BDFDepth(bv->bdf));
}
static void BVCopyRef(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
BCCopyReference(bv->bc,bv->bdf->pixelsize,BDFDepth(bv->bdf));
}
static void BVDoClear(BitmapView *bv) {
if ( bv->bc->selection!=NULL ) {
BCPreserveState(bv->bc);
BDFFloatFree(bv->bc->selection);
BDFRefChar *head, *next;
BDFChar *bc = bv->bc;
int refs_changed = false;
for ( head=bc->refs; head!=NULL; head=next ) {
next = head->next;
if ( head->selected ) {
if ( !refs_changed ) {
BCPreserveState( bc );
refs_changed = true;
}
BCRemoveDependent( bc,head );
}
}
if ( bc->selection!=NULL ) {
BCPreserveState( bc );
BDFFloatFree( bc->selection );
bv->bc->selection = NULL;
BCCharChangedUpdate(bv->bc);
BCCharChangedUpdate( bc );
} else if ( refs_changed ) {
BCCharChangedUpdate( bc );
}
}
@ -1607,8 +1872,6 @@ static void BVPaste(GWindow gw,struct gmenuitem *mi,GEvent *e) {
static void BVCut(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
if ( bv->bc->selection==NULL )
return;
BVCopy(gw,mi,e);
BVDoClear(bv);
}
@ -1698,7 +1961,7 @@ void BVMenuRotateInvoked(GWindow gw,struct gmenuitem *mi,GEvent *g) {
BVRotateBitmap(bv,mi->mid);
}
static void edlistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
static void ellistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) {
@ -1710,14 +1973,19 @@ static void edlistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
}
}
static void ellistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
static void edlistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
BitmapView *bv = (BitmapView *) GDrawGetUserData(gw);
BDFRefChar *cur;
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) {
switch ( mi->mid ) {
case MID_Cut: /*case MID_Copy:*/ case MID_Clear:
/* If nothing is selected, copy copies everything */
mi->ti.disabled = bv->bc->selection==NULL;
for ( cur=bv->bc->refs; cur!=NULL && mi->ti.disabled; cur=cur->next ) {
if ( cur->selected )
mi->ti.disabled = false;
}
break;
case MID_Paste:
mi->ti.disabled = !CopyContainsBitmap();
@ -1731,6 +1999,9 @@ static void ellistcheck(GWindow gw,struct gmenuitem *mi,GEvent *e) {
case MID_RemoveUndoes:
mi->ti.disabled = bv->bc->redoes==NULL && bv->bc->undoes==NULL;
break;
case MID_UnlinkRef:
mi->ti.disabled = bv->bc->refs==NULL;
break;
}
}
}
@ -1830,7 +2101,7 @@ char *BVFlipNames[] = { N_("Flip Horizontally"), N_("Flip Vertically"),
NU_("Rotate 90° CCW"),
NU_("Rotate 180°"),
N_("Skew..."), NULL };
static GMenuItem2 dummyitem[] = { { (unichar_t *) N_("Font|_New"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, NULL };
static GMenuItem2 fllist[] = {
{ { (unichar_t *) N_("Font|_New"), (GImage *) "filenew.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, H_("New|Ctl+N"), NULL, NULL, MenuNew },
@ -1842,6 +2113,7 @@ static GMenuItem2 fllist[] = {
{ { (unichar_t *) N_("S_ave as..."), (GImage *) "filesaveas.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'a' }, H_("Save as...|Ctl+Shft+S"), NULL, NULL, BVMenuSaveAs },
{ { (unichar_t *) N_("_Generate Fonts..."), (GImage *) "filegenerate.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'G' }, H_("Generate Fonts...|Ctl+Shft+G"), NULL, NULL, BVMenuGenerate },
{ { (unichar_t *) N_("Generate Mac _Family..."), (GImage *) "filegeneratefamily.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Generate Mac Family...|Alt+Ctl+G"), NULL, NULL, BVMenuGenerateFamily },
{ { (unichar_t *) N_("Generate TTC..."), (GImage *) "filegeneratefamily.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Generate TTC...|No Shortcut"), NULL, NULL, BVMenuGenerateTTC },
{ { (unichar_t *) N_("Expor_t..."), (GImage *) "fileexport.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 't' }, H_("Export...|No Shortcut"), NULL, NULL, BVMenuExport },
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }},
{ { (unichar_t *) N_("_Import..."), (GImage *) "fileimport.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Import...|Ctl+Shft+I"), NULL, NULL, BVMenuImport },
@ -1860,12 +2132,15 @@ static GMenuItem2 edlist[] = {
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }},
{ { (unichar_t *) N_("Cu_t"), (GImage *) "editcut.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 't' }, H_("Cut|Ctl+X"), NULL, NULL, BVCut, MID_Cut },
{ { (unichar_t *) N_("_Copy"), (GImage *) "editcopy.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Copy|Ctl+C"), NULL, NULL, BVCopy, MID_Copy },
{ { (unichar_t *) N_("C_opy Reference"), (GImage *) "editcopyref.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Copy Reference|Ctl+G"), NULL, NULL, BVCopyRef, MID_CopyRef },
{ { (unichar_t *) N_("_Paste"), (GImage *) "editpaste.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Paste|Ctl+V"), NULL, NULL, BVPaste, MID_Paste },
{ { (unichar_t *) N_("C_lear"), (GImage *) "editclear.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Clear|Delete"), NULL, NULL, BVClear, MID_Clear },
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }},
{ { (unichar_t *) N_("Select _All"), (GImage *) "editselect.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("Select All|Ctl+A"), NULL, NULL, BVSelectAll, MID_SelAll },
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }},
{ { (unichar_t *) N_("Remo_ve Undoes"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'e' }, H_("Remove Undoes|No Shortcut"), NULL, NULL, BVRemoveUndoes, MID_RemoveUndoes },
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }},
{ { (unichar_t *) N_("U_nlink Reference"), (GImage *) "editunlink.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'U' }, H_("Unlink Reference|Ctl+U"), NULL, NULL, BVUnlinkRef, MID_UnlinkRef },
{ NULL }
};
@ -2060,14 +2335,14 @@ BitmapView *BitmapViewCreate(BDFChar *bc, BDFFont *bdf, FontView *fv, int enc) {
wattrs.mask = wam_events|wam_cursor|wam_backcol;
wattrs.background_color = view_bgcol;
wattrs.event_masks = -1;
wattrs.cursor = ct_pencil;
wattrs.cursor = ( bc->refs == NULL ) ? ct_pencil : ct_pointer;
bv->v = GWidgetCreateSubWindow(gw,&pos,v_e_h,bv,&wattrs);
bv->height = pos.height; bv->width = pos.width;
bv->b1_tool = bvt_pencil; bv->cb1_tool = bvt_pointer;
bv->b1_tool = ( bc->refs == NULL ) ? bvt_pencil : bvt_pointer; bv->cb1_tool = bvt_pointer;
bv->b2_tool = bvt_magnify; bv->cb2_tool = bvt_shift;
bv->s1_tool = bv->s2_tool = bv->er_tool = bvt_pointer;
bv->showing_tool = bvt_pencil;
bv->showing_tool = ( bc->refs == NULL ) ? bvt_pencil : bvt_pointer;
bv->pressed_tool = bv->pressed_display = bv->active_tool = bvt_none;
/*GWidgetHidePalettes();*/

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -307,10 +307,29 @@ static void BCExpandBitmap(BDFChar *bc, int x, int y) {
}
}
static int BCHasOutputtableBitmap( BDFChar *bc ) {
int i;
for ( i=0; i<bc->bytes_per_line * ( bc->ymax - bc->ymin + 1 ); i++ ) {
if ( bc->bitmap[i] != 0 )
return( true );
}
return( false );
}
void BCExpandBitmapToEmBox(BDFChar *bc, int xmin, int ymin, int xmax, int ymax) {
/* Expand a bitmap so it will always contain 0..width, ascent..descent */
BCExpandBitmap(bc,xmin,ymin);
BCExpandBitmap(bc,xmax,ymax);
if ( !BCHasOutputtableBitmap( bc )) {
free( bc->bitmap );
bc->bytes_per_line = xmax - xmin + 1;
bc->xmin = xmin; bc->xmax = xmax;
bc->ymin = ymin; bc->ymax = ymax;
bc->bitmap = gcalloc(( ymax - ymin + 1) * bc->bytes_per_line, sizeof( uint8 ));
} else {
BCExpandBitmap(bc,xmin,ymin);
BCExpandBitmap(bc,xmax,ymax);
}
}
void BCSetPoint(BDFChar *bc, int x, int y, int color ) {
@ -457,8 +476,7 @@ void BCFlattenFloat(BDFChar *bc ) {
uint8 *bpt, *spt;
if ( sel!=NULL ) {
BCExpandBitmap(bc,sel->xmin,sel->ymin);
BCExpandBitmap(bc,sel->xmax,sel->ymax);
BCExpandBitmapToEmBox( bc,sel->xmin,sel->ymin,sel->xmax,sel->ymax );
if ( bc->byte_data ) {
for ( y=sel->ymin; y<=sel->ymax; ++y ) {
bpt = bc->bitmap + (bc->ymax-y)*bc->bytes_per_line;
@ -484,23 +502,28 @@ void BCFlattenFloat(BDFChar *bc ) {
}
void BCPasteInto(BDFChar *bc,BDFChar *rbc,int ixoff,int iyoff, int invert, int cleartoo) {
int x,y;
int x, y, bx, rx;
uint8 *bpt, *rpt;
x = 0;
BCExpandBitmap(bc,rbc->xmin+ixoff,rbc->ymin+iyoff);
BCExpandBitmap(bc,rbc->xmax+ixoff,rbc->ymax+iyoff);
BCExpandBitmapToEmBox( bc,rbc->xmin+ixoff,rbc->ymin+iyoff,rbc->xmax+ixoff,rbc->ymax+iyoff );
for ( y=rbc->ymin; y<=rbc->ymax; ++y ) {
bpt = bc->bitmap + (bc->ymax-(y+iyoff))*bc->bytes_per_line;
if ( invert )
rpt = rbc->bitmap + y*rbc->bytes_per_line;
else
rpt = rbc->bitmap + (rbc->ymax-y)*rbc->bytes_per_line;
if ( bc->byte_data )
memcpy(bpt+x+ixoff-bc->xmin,rpt,rbc->xmax-rbc->xmin+1);
else {
if ( bc->byte_data ) {
for ( x=rbc->xmin; x<=rbc->xmax; ++x ) {
int bx = x+ixoff-bc->xmin, rx = x-rbc->xmin;
bx = x+ixoff-bc->xmin; rx = x-rbc->xmin;
if ( rpt[rx] != 0 )
bpt[bx] |= rpt[rx];
else if ( cleartoo )
bpt[bx] &= rpt[rx];
}
} else {
for ( x=rbc->xmin; x<=rbc->xmax; ++x ) {
bx = x+ixoff-bc->xmin; rx = x-rbc->xmin;
if ( rpt[rx>>3]&(1<<(7-(rx&7))) )
bpt[bx>>3] |= (1<<(7-(bx&7)));
else if ( cleartoo )
@ -511,6 +534,68 @@ void BCPasteInto(BDFChar *bc,BDFChar *rbc,int ixoff,int iyoff, int invert, int c
BCCompressBitmap(bc);
}
void BCMergeReferences(BDFChar *base,BDFChar *cur,int8 xoff,int8 yoff) {
BDFRefChar *head;
for ( head=cur->refs; head!=NULL; head=head->next ) {
BCPasteInto( base,head->bdfc,xoff+head->xoff,yoff+head->yoff,false,false );
BCMergeReferences( base,head->bdfc,xoff+head->xoff,yoff+head->yoff );
}
}
BDFChar *BDFGetMergedChar( BDFChar *bc ) {
BDFChar *ret;
if ( bc == NULL )
return( NULL );
ret = chunkalloc( sizeof( BDFChar ));
memcpy( ret,bc,sizeof( BDFChar ));
ret->bitmap = gcalloc(ret->bytes_per_line*(ret->ymax-ret->ymin+1),sizeof(uint8));
memcpy( ret->bitmap,bc->bitmap,ret->bytes_per_line*(ret->ymax-ret->ymin+1));
BCMergeReferences( ret,bc,0,0 );
ret->refs = NULL;
if ( bc->selection != NULL ) {
ret->selection = BDFFloatConvert(bc->selection,bc->depth,bc->depth);
BCFlattenFloat( ret );
BCCompressBitmap( ret );
}
return( ret );
}
int BDFCharQuickBounds( BDFChar *bc,IBounds *bb,int8 xoff,int8 yoff,int use_backup,int first ) {
int bmp_width, has_bitmap = false;
int xmin, xmax, ymin, ymax;
BDFRefChar *head;
if ( use_backup && bc->backup != NULL ) {
xmin = bc->backup->xmin; xmax = bc->backup->xmax;
ymin = bc->backup->ymin; ymax = bc->backup->ymax;
} else {
xmin = bc->xmin; xmax = bc->xmax;
ymin = bc->ymin; ymax = bc->ymax;
}
bmp_width = xmax - xmin + 1;
has_bitmap = BCHasOutputtableBitmap( bc );
if ( has_bitmap && first ) {
bb->minx = xmin + xoff; bb->maxx = xmax + xoff;
bb->miny = ymin + yoff; bb->maxy = ymax + yoff;
} else if ( has_bitmap ) {
if ( xmin + xoff < bb->minx ) bb->minx = xmin + xoff;
if ( xmax + xoff > bb->maxx ) bb->maxx = xmax + xoff;
if ( ymin + yoff < bb->miny ) bb->miny = ymin + yoff;
if ( ymax + yoff > bb->maxy ) bb->maxy = ymax + yoff;
} else if ( first )
memset(bb,0,sizeof(*bb));
for ( head=bc->refs; head!=NULL; head=head->next ) {
first = BDFCharQuickBounds( head->bdfc,bb,head->xoff+xoff,head->yoff+yoff,
has_bitmap || use_backup,first && !has_bitmap );
}
return( first && !has_bitmap );
}
void BDFCharFindBounds(BDFChar *bc,IBounds *bb) {
int r,c,first=true;
@ -547,10 +632,156 @@ void BDFCharFindBounds(BDFChar *bc,IBounds *bb) {
}
}
}
first = BDFCharQuickBounds( bc,bb,0,0,false,first );
if ( first )
memset(bb,0,sizeof(*bb));
}
/* Prepare a bitmap glyph for dumping to a font file. This function deals */
/* mainly with composite glyphs, and either converts them to normal bitmaps */
/* or regularizes for output. The current glyph state is preserved and can */
/* be restored later */
void BCPrepareForOutput( BDFChar *bc,int mergeall ) {
int bmp_has_image = false, bmp_width;
int i;
IBounds ib;
bmp_width = ( bc->ymax - bc->ymin + 1 );
bc->ticked = false;
if ( bc->refs != NULL ) {
/* Preserve the current glyph bitmap with all related values, unless we */
/* have already done this when detecting width groups for TTF output */
if ( bc->backup == NULL ) {
bc->backup = galloc( sizeof( BDFFloat ));
bc->backup->bytes_per_line = bc->bytes_per_line;
bc->backup->xmin = bc->xmin; bc->backup->xmax = bc->xmax;
bc->backup->ymin = bc->ymin; bc->backup->ymax = bc->ymax;
bc->backup->bitmap = gcalloc( bc->bytes_per_line * bmp_width,sizeof( uint8 ));
memcpy( bc->backup->bitmap,bc->bitmap,bc->bytes_per_line * bmp_width );
}
for ( i=0; i<bc->bytes_per_line * bmp_width && !bmp_has_image; i++ ) {
if ( bc->bitmap[i] != 0 ) bmp_has_image = true;
}
if ( mergeall || bmp_has_image ) {
/* Can't output glyphs which contain both bitmaps and references. So */
/* we merge references into a single bitmap either if the glyph's */
/* bitmap already has something worth outputting, or if the font format */
/* doesn't support references at all (in which case 'mergeall' should */
/* be true) */
/* If the glyph is going to be output in a width group (EBDT format 5), */
/* then unlinking references will compress the bitmap to the actual image*/
/* size. So preserve the original values and restore them after merging */
if ( bc->widthgroup ) {
ib.minx = bc->xmin; ib.maxx = bc->xmax;
ib.miny = bc->ymin; ib.maxy = bc->ymax;
}
BCMergeReferences( bc,bc,0,0 );
if ( bc->widthgroup )
BCExpandBitmapToEmBox( bc,ib.minx,ib.miny,ib.maxx,ib.maxy );
} else {
/* Otherwise we are going to output a composite glyph. Note that bounding box */
/* values have different meaning in our program context (there they denote */
/* the bitmap size and position and thus are mostly irrelevant for a glyph were*/
/* only references are present) and in the EBDT table. In the later case they */
/* are used to specify the overall glyph metrics. So we calculate those values */
/* just for TTF output and then immediately reset them back to zeros. */
BDFCharQuickBounds( bc,&ib,0,0,false,true );
bc->xmin = ib.minx; bc->xmax = ib.maxx;
bc->ymin = ib.miny; bc->ymax = ib.maxy;
bc->ticked = true;
}
} else if ( !bc->widthgroup )
BCCompressBitmap( bc );
}
void BCRestoreAfterOutput( BDFChar *bc ) {
bc->ticked = false;
if ( bc->backup != NULL ) {
bc->bytes_per_line = bc->backup->bytes_per_line;
bc->xmin = bc->backup->xmin; bc->xmax = bc->backup->xmax;
bc->ymin = bc->backup->ymin; bc->ymax = bc->backup->ymax;
free( bc->bitmap );
bc->bitmap = bc->backup->bitmap;
free( bc->backup );
bc->backup = NULL;
}
}
void BCMakeDependent( BDFChar *dependent,BDFChar *base ) {
struct bdfcharlist *dlist;
for ( dlist=base->dependents; dlist!=NULL && dlist->bc!=dependent; dlist = dlist->next );
if ( dlist==NULL ) {
dlist = chunkalloc( sizeof( struct bdfcharlist ));
dlist->bc = dependent;
dlist->next = base->dependents;
base->dependents = dlist;
}
}
void BCRemoveDependent( BDFChar *dependent,BDFRefChar *ref ) {
struct bdfcharlist *dlist, *pd;
BDFRefChar *prev;
if ( dependent->refs==ref )
dependent->refs = ref->next;
else {
for ( prev = dependent->refs; prev->next!=ref; prev=prev->next );
prev->next = ref->next;
}
/* Check for multiple dependencies (colon has two refs to period) */
/* if there are none, then remove dependent from ref->sc's dependents list */
for ( prev = dependent->refs; prev!=NULL && (prev==ref || prev->bdfc!=ref->bdfc); prev = prev->next );
if ( prev==NULL ) {
dlist = ref->bdfc->dependents;
if ( dlist==NULL )
/* Do nothing */;
else if ( dlist->bc == dependent ) {
ref->bdfc->dependents = dlist->next;
} else {
for ( pd=dlist, dlist = pd->next; dlist!=NULL && dlist->bc!=dependent; pd=dlist, dlist = pd->next );
if ( dlist!=NULL )
pd->next = dlist->next;
}
chunkfree( dlist,sizeof( struct bdfcharlist ));
}
free( ref );
}
void BCUnlinkThisReference( struct fontviewbase *fv,BDFChar *bc ) {
struct bdfcharlist *dep, *dnext;
BDFChar *bsc;
BDFRefChar *ref, *rnext, *rprev = NULL;
if ( bc==NULL )
return;
for ( dep=bc->dependents; dep!=NULL; dep=dnext ) {
dnext = dep->next;
if ( fv==NULL || !fv->selected[fv->map->backmap[dep->bc->orig_pos]]) {
bsc = dep->bc;
/* May be more than one reference to us, colon has two refs to period */
/* but only one dlist entry */
for ( ref = bsc->refs; ref!=NULL; ref=rnext ) {
rnext = ref->next;
if ( ref->bdfc == bc ) {
BCPasteInto( bsc,bc,ref->xoff,ref->yoff,0,0 );
if ( rprev == NULL )
bsc->refs = rnext;
else
rprev->next = rnext;
free( ref );
BCCharChangedUpdate( bsc );
} else
rprev = ref;
}
}
}
}
static BDFChar *BCScale(BDFChar *old,int from, int to) {
BDFChar *new;
int x,y, ox,oy, oxs,oys, oxend, oyend;
@ -577,6 +808,8 @@ return( NULL );
new->bytes_per_line = (new->xmax-new->xmin)/8+1;
new->bitmap = gcalloc((new->ymax-new->ymin+1)*new->bytes_per_line,sizeof(char));
new->orig_pos = old->orig_pos;
new->refs = old->refs;
new->dependents = old->dependents;
scale = from/dto;
scale *= scale;
@ -648,6 +881,8 @@ return( NULL );
new->byte_data = true;
}
new->orig_pos = old->orig_pos;
new->refs = old->refs;
new->dependents = old->dependents;
scale = from/dto;
scale *= scale;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <ustring.h>
#include <math.h>
#include <utype.h>
@ -39,7 +39,7 @@ static int last_gi_aspect = 0;
typedef struct charinfo {
CharView *cv;
EncMap *map;
SplineChar *sc;
SplineChar *sc, *cachedsc;
int def_layer;
SplineChar *oldsc; /* oldsc->charinfo will point to us. Used to keep track of that pointer */
int enc;
@ -49,6 +49,8 @@ typedef struct charinfo {
int r,c;
int lc_seen, lc_aspect, vert_aspect;
Color last, real_last;
struct splinecharlist *changes;
int name_change, uni_change;
} CharInfo;
#define CI_Width 218
@ -532,7 +534,7 @@ static int CI_NameCheck(const unichar_t *name) {
if ( uc_strcmp(name,".notdef")==0 ) /* This name is a special case and doesn't follow conventions */
return( true );
if ( u_strlen(name)>31 ) {
ff_post_error(_("Bad Name"),_("Glyph names are limitted to 31 characters"));
ff_post_error(_("Bad Name"),_("Glyph names are limited to 31 characters"));
return( false );
} else if ( *name=='\0' ) {
ff_post_error(_("Bad Name"),_("Bad Name"));
@ -565,7 +567,7 @@ return( true );
static void CI_ParseCounters(CharInfo *ci) {
int32 i,len;
GTextInfo **ti = GGadgetGetList(GWidgetGetControl(ci->gw,CID_List+600),&len);
SplineChar *sc = ci->sc;
SplineChar *sc = ci->cachedsc;
free(sc->countermasks);
@ -717,7 +719,7 @@ void KpMDParse(SplineFont *sf,SplineChar *sc,struct lookup_subtable *sub,
while ( *start==' ' ) ++start;
if ( *start=='\0' )
break;
for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
for ( pt=start; *pt!='\0' && *pt!=' ' && *pt!='('; ++pt );
ch = *pt; *pt = '\0';
other = SFGetChar(sc->parent,-1,start);
for ( pst=sc->possub; pst!=NULL; pst=pst->next ) {
@ -846,6 +848,10 @@ void KpMDParse(SplineFont *sf,SplineChar *sc,struct lookup_subtable *sub,
pst->ticked = true;
}
*pt = ch;
if ( ch=='(' ) {
while ( *pt!=')' && *pt!='\0' ) ++pt;
if ( *pt==')' ) ++pt;
}
start = pt;
}
}
@ -855,7 +861,7 @@ static int CI_ProcessPosSubs(CharInfo *ci) {
/* complain and return failure */
/* Check for various other errors */
/* Otherwise process */
SplineChar *sc = ci->sc, *found;
SplineChar *sc = ci->cachedsc, *found;
int i,j, rows, cols, isv, pstt, ch;
char *pt;
struct matrix_data *possub;
@ -921,7 +927,7 @@ return( true );
return( false );
}
while ( *start ) {
for ( pt=start; *pt!='\0' && *pt!=' '; ++pt );
for ( pt=start; *pt!='\0' && *pt!=' ' && *pt!='(' ; ++pt );
ch = *pt; *pt='\0';
found = SFGetChar(sc->parent,-1,start);
if ( found==NULL ) {
@ -945,6 +951,10 @@ return( false );
}
}
*pt = ch;
if ( ch=='(' ) {
while ( *pt!=')' && *pt!='\0' ) ++pt;
if ( *pt==')' ) ++pt;
}
while ( *pt== ' ' ) ++pt;
start = pt;
}
@ -976,7 +986,7 @@ return( false );
} else
free( pst->u.subs.variant );
pst->ticked = true;
pst->u.subs.variant = copy( possub[cols*i+1].u.md_str );
pst->u.subs.variant = GlyphNameListDeUnicode( possub[cols*i+1].u.md_str );
if ( pstt==pst_ligature )
pst->u.lig.lig = sc;
}
@ -1154,7 +1164,7 @@ static void CI_ParseAltUnis(CharInfo *ci) {
struct matrix_data *stuff = GMatrixEditGet(au,&rows);
int i;
struct altuni *altuni, *last = NULL;
SplineChar *sc = ci->sc;
SplineChar *sc = ci->cachedsc;
int deenc = false;
FontView *fvs;
int oldcnt, newcnt;
@ -1201,12 +1211,208 @@ static void CI_ParseAltUnis(CharInfo *ci) {
}
}
static KernPair *CI_KPCopy(KernPair *kp) {
KernPair *head=NULL, *last=NULL, *newkp;
while ( kp!=NULL ) {
newkp = chunkalloc(sizeof(KernPair));
*newkp = *kp;
#ifdef FONTFORGE_CONFIG_DEVICETABLES
newkp->adjust = DeviceTableCopy(kp->adjust);
#endif
newkp->next = NULL;
if ( head==NULL )
head = newkp;
else
last->next = newkp;
last = newkp;
kp = kp->next;
}
return( head );
}
static PST *CI_PSTCopy(PST *pst) {
PST *head=NULL, *last=NULL, *newpst;
while ( pst!=NULL ) {
newpst = chunkalloc(sizeof(KernPair));
*newpst = *pst;
if ( newpst->type==pst_ligature ) {
newpst->u.lig.components = copy(pst->u.lig.components);
} else if ( newpst->type==pst_pair ) {
newpst->u.pair.paired = copy(pst->u.pair.paired);
newpst->u.pair.vr = chunkalloc(sizeof( struct vr [2]));
memcpy(newpst->u.pair.vr,pst->u.pair.vr,sizeof(struct vr [2]));
#ifdef FONTFORGE_CONFIG_DEVICETABLES
newpst->u.pair.vr[0].adjust = ValDevTabCopy(pst->u.pair.vr[0].adjust);
newpst->u.pair.vr[1].adjust = ValDevTabCopy(pst->u.pair.vr[1].adjust);
#endif
} else if ( newpst->type==pst_lcaret ) {
newpst->u.lcaret.carets = galloc(pst->u.lcaret.cnt*sizeof(uint16));
memcpy(newpst->u.lcaret.carets,pst->u.lcaret.carets,pst->u.lcaret.cnt*sizeof(uint16));
} else if ( newpst->type==pst_substitution || newpst->type==pst_multiple || newpst->type==pst_alternate )
newpst->u.subs.variant = copy(pst->u.subs.variant);
newpst->next = NULL;
if ( head==NULL )
head = newpst;
else
last->next = newpst;
last = newpst;
pst = pst->next;
}
return( head );
}
static SplineChar *CI_SCDuplicate(SplineChar *sc) {
SplineChar *newsc; /* copy everything we care about in this dlg */
newsc = chunkalloc(sizeof(SplineChar));
newsc->name = copy(sc->name);
newsc->unicodeenc = sc->unicodeenc;
newsc->orig_pos = sc->orig_pos;
newsc->comment = copy(sc->comment);
newsc->unlink_rm_ovrlp_save_undo = sc->unlink_rm_ovrlp_save_undo;
newsc->glyph_class = sc->glyph_class;
newsc->color = sc->color;
if ( sc->countermask_cnt!=0 ) {
newsc->countermask_cnt = sc->countermask_cnt;
newsc->countermasks = galloc(sc->countermask_cnt*sizeof(HintMask));
memcpy(newsc->countermasks,sc->countermasks,sc->countermask_cnt*sizeof(HintMask));
}
newsc->tex_height = sc->tex_height;
newsc->tex_depth = sc->tex_depth;
newsc->italic_correction = sc->italic_correction;
newsc->top_accent_horiz = sc->top_accent_horiz;
newsc->is_extended_shape = sc->is_extended_shape;
#ifdef FONTFORGE_CONFIG_DEVICETABLES
newsc->italic_adjusts = DeviceTableCopy(sc->italic_adjusts);
newsc->top_accent_adjusts = DeviceTableCopy(sc->top_accent_adjusts);
#endif
newsc->horiz_variants = GlyphVariantsCopy(sc->horiz_variants);
newsc->vert_variants = GlyphVariantsCopy(sc->vert_variants);
newsc->altuni = AltUniCopy(sc->altuni,NULL);
newsc->lig_caret_cnt_fixed = sc->lig_caret_cnt_fixed;
newsc->possub = CI_PSTCopy(sc->possub);
newsc->kerns = CI_KPCopy(sc->kerns);
newsc->vkerns = CI_KPCopy(sc->vkerns);
#ifdef FONTFORGE_CONFIG_TYPE3
newsc->tile_margin = sc->tile_margin;
newsc->tile_bounds = sc->tile_bounds;
#endif
return( newsc );
}
static int CI_CheckMetaData(CharInfo *ci,SplineChar *oldsc,char *name,int unienc, char *comment) {
SplineFont *sf = oldsc->parent;
int i;
int isnotdef, samename=false, sameuni=false;
struct altuni *alt;
SplineChar *newsc = ci->cachedsc;
struct splinecharlist *scl, *baduniscl, *badnamescl;
SplineChar *baduni, *badname;
for ( alt=oldsc->altuni; alt!=NULL && (alt->unienc!=unienc || alt->vs!=-1 || alt->fid!=0); alt=alt->next );
if ( unienc==oldsc->unicodeenc || alt!=NULL )
sameuni=true;
samename = ( strcmp(name,oldsc->name)==0 );
isnotdef = strcmp(name,".notdef")==0;
if (( !sameuni && unienc!=-1) || (!samename && !isnotdef) ) {
baduniscl = badnamescl = NULL;
baduni = badname = NULL;
for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL && sf->glyphs[i]!=ci->sc ) {
if ( unienc!=-1 && sf->glyphs[i]->unicodeenc==unienc ) {
for ( scl=ci->changes; scl!=NULL && scl->sc->orig_pos!=i; scl = scl->next );
if ( scl==NULL ) {
baduni = sf->glyphs[i];
baduniscl = NULL;
} else if ( scl->sc->unicodeenc==unienc ) {
baduni = scl->sc;
baduniscl = scl;
}
}
if ( !isnotdef && strcmp(name,sf->glyphs[i]->name )==0 ) {
for ( scl=ci->changes; scl!=NULL && scl->sc->orig_pos!=i; scl = scl->next );
if ( scl==NULL ) {
badname = sf->glyphs[i];
badnamescl = NULL;
} else if ( strcmp(scl->sc->name,name)==0 ) {
badname = scl->sc;
badnamescl = scl;
}
}
}
for ( scl=ci->changes; scl!=NULL ; scl = scl->next ) if ( scl->sc!=newsc ) {
if ( unienc!=-1 && scl->sc->unicodeenc==unienc ) {
baduni = scl->sc;
baduniscl = scl;
}
if ( !isnotdef && strcmp(scl->sc->name,name)==0 ) {
badname = scl->sc;
badnamescl = scl;
}
}
if ( baduni!=NULL || badname!=NULL ) {
char *buts[3];
buts[0] = _("_Yes"); buts[1]=_("_Cancel"); buts[2] = NULL;
if ( badname==baduni ) {
if ( ff_ask(_("Multiple"),(const char **) buts,0,1,_("There is already a glyph with this name and encoding,\nboth must be unique within a font,\ndo you want to swap them?"))==1 )
return( false );
/* If we're going to swap, then add the swapee to the list of */
/* things that need changing */
if ( baduniscl==NULL ) {
baduni = CI_SCDuplicate(baduni);
baduniscl = chunkalloc(sizeof(struct splinecharlist));
baduniscl->sc = baduni;
baduniscl->next = ci->changes;
ci->changes = baduniscl;
}
baduni->unicodeenc = oldsc->unicodeenc;
free(baduni->name); baduni->name = copy(oldsc->name);
} else {
if ( baduni!=NULL ) {
if ( ff_ask(_("Multiple"),(const char **) buts,0,1,_("There is already a glyph with this encoding,\nwhich must be unique within a font,\ndo you want to swap the encodings of the two?"))==1 )
return( false );
if ( baduniscl==NULL ) {
baduni = CI_SCDuplicate(baduni);
baduniscl = chunkalloc(sizeof(struct splinecharlist));
baduniscl->sc = baduni;
baduniscl->next = ci->changes;
ci->changes = baduniscl;
}
baduni->unicodeenc = oldsc->unicodeenc;
}
if ( badname!=NULL ) {
if ( ff_ask(_("Multiple"),(const char **) buts,0,1,_("There is already a glyph with this name,\nwhich must be unique within a font,\ndo you want to swap the names of the two?"))==1 )
return( false );
if ( badnamescl==NULL ) {
badname = CI_SCDuplicate(badname);
badnamescl = chunkalloc(sizeof(struct splinecharlist));
badnamescl->sc = badname;
badnamescl->next = ci->changes;
ci->changes = badnamescl;
}
free(badname->name); badname->name = copy(oldsc->name);
}
}
}
}
if ( !samename )
ci->name_change = true;
if ( !sameuni )
ci->uni_change = true;
free( newsc->name ); free( newsc->comment );
newsc->name = copy( name );
newsc->unicodeenc = unienc;
newsc->comment = copy( comment );
return( true );
}
static int _CI_OK(CharInfo *ci) {
int val;
int ret, refresh_fvdi=0;
int ret;
char *name, *comment;
const unichar_t *nm;
FontView *fvs;
int err = false;
int tex_height, tex_depth, italic, topaccent;
int hic, vic;
@ -1220,6 +1426,7 @@ static int _CI_OK(CharInfo *ci) {
real tile_margin=0;
DBounds tileb;
#endif
SplineChar *oldsc = ci->cachedsc==NULL ? ci->sc : ci->cachedsc;
if ( !CI_ValidateAltUnis(ci))
return( false );
@ -1282,6 +1489,17 @@ return( false );
return( false );
}
#endif
if ( ci->cachedsc==NULL ) {
struct splinecharlist *scl;
ci->cachedsc = chunkalloc(sizeof(SplineChar));
ci->cachedsc->orig_pos = ci->sc->orig_pos;
ci->cachedsc->parent = ci->sc->parent;
scl = chunkalloc(sizeof(struct splinecharlist));
scl->sc = ci->cachedsc;
scl->next = ci->changes;
ci->changes = scl;
}
/* CI_ProcessPosSubs is the first thing which might change anything real */
if ( !CI_ProcessPosSubs(ci)) {
free( accentdevtab );
free( italicdevtab );
@ -1289,41 +1507,36 @@ return( false );
return( false );
}
name = u2utf8_copy( nm );
if ( strcmp(name,ci->sc->name)!=0 || val!=ci->sc->unicodeenc )
refresh_fvdi = 1;
comment = GGadgetGetTitle8(GWidgetGetControl(ci->gw,CID_Comment));
SCPreserveState(ci->sc,2);
ret = SCSetMetaData(ci->sc,name,val,comment);
if ( comment!=NULL && *comment=='\0' ) {
free(comment);
comment=NULL;
}
ret = CI_CheckMetaData(ci,oldsc,name,val,comment);
free(name); free(comment);
ci->sc->unlink_rm_ovrlp_save_undo = GGadgetIsChecked(GWidgetGetControl(ci->gw,CID_UnlinkRmOverlap));
if ( refresh_fvdi ) {
for ( fvs=(FontView *) ci->sc->parent->fv; fvs!=NULL; fvs=(FontView *) fvs->b.next ) {
GDrawRequestExpose(fvs->gw,NULL,false); /* Redraw info area just in case this char is selected */
GDrawRequestExpose(fvs->v,NULL,false); /* Redraw character area in case this char is on screen */
}
if ( !ret ) {
free( accentdevtab );
free( italicdevtab );
free(hicdt); free(vicdt);
return( false );
}
if ( ret ) {
ci->sc->glyph_class = GGadgetGetFirstListSelectedItem(GWidgetGetControl(ci->gw,CID_GClass));
val = GGadgetGetFirstListSelectedItem(GWidgetGetControl(ci->gw,CID_Color));
if ( val!=-1 ) {
if ( ci->sc->color != (int) (intpt) (std_colors[val].userdata) ) {
ci->sc->color = (intpt) (std_colors[val].userdata);
for ( fvs=(FontView *) ci->sc->parent->fv; fvs!=NULL; fvs=(FontView *) fvs->b.next )
GDrawRequestExpose(fvs->v,NULL,false); /* Redraw info area just in case this char is selected */
}
}
CI_ParseCounters(ci);
ci->sc->tex_height = tex_height;
ci->sc->tex_depth = tex_depth;
ci->sc->italic_correction = italic;
ci->sc->is_extended_shape = GGadgetIsChecked(GWidgetGetControl(ci->gw,CID_IsExtended));
ci->cachedsc->unlink_rm_ovrlp_save_undo = GGadgetIsChecked(GWidgetGetControl(ci->gw,CID_UnlinkRmOverlap));
ci->cachedsc->glyph_class = GGadgetGetFirstListSelectedItem(GWidgetGetControl(ci->gw,CID_GClass));
val = GGadgetGetFirstListSelectedItem(GWidgetGetControl(ci->gw,CID_Color));
if ( val!=-1 )
ci->cachedsc->color = (intpt) (std_colors[val].userdata);
CI_ParseCounters(ci);
ci->cachedsc->tex_height = tex_height;
ci->cachedsc->tex_depth = tex_depth;
ci->cachedsc->italic_correction = italic;
ci->cachedsc->top_accent_horiz = topaccent;
ci->cachedsc->is_extended_shape = GGadgetIsChecked(GWidgetGetControl(ci->gw,CID_IsExtended));
#ifdef FONTFORGE_CONFIG_DEVICETABLES
ci->sc->italic_adjusts = DeviceTableParse(ci->sc->italic_adjusts,italicdevtab);
ci->sc->top_accent_adjusts = DeviceTableParse(ci->sc->top_accent_adjusts,accentdevtab);
ci->cachedsc->italic_adjusts = DeviceTableParse(ci->cachedsc->italic_adjusts,italicdevtab);
ci->cachedsc->top_accent_adjusts = DeviceTableParse(ci->cachedsc->top_accent_adjusts,accentdevtab);
#endif
}
ci->sc->horiz_variants = CI_ParseVariants(ci->sc->horiz_variants,ci,1,hicdt,hic,false);
ci->sc->vert_variants = CI_ParseVariants(ci->sc->vert_variants ,ci,0,vicdt,vic,false);
ci->cachedsc->horiz_variants = CI_ParseVariants(ci->cachedsc->horiz_variants,ci,1,hicdt,hic,false);
ci->cachedsc->vert_variants = CI_ParseVariants(ci->cachedsc->vert_variants ,ci,0,vicdt,vic,false);
free( accentdevtab );
free( italicdevtab );
@ -1331,19 +1544,17 @@ return( false );
CI_ParseAltUnis(ci);
if ( ret )
ci->sc->parent->changed = true;
if ( ret && ci->lc_seen ) {
if ( ci->lc_seen ) {
PST *pst, *prev=NULL;
int i;
ci->sc->lig_caret_cnt_fixed = lig_caret_cnt_fixed;
for ( pst = ci->sc->possub; pst!=NULL && pst->type!=pst_lcaret; pst=pst->next )
ci->cachedsc->lig_caret_cnt_fixed = lig_caret_cnt_fixed;
for ( pst = ci->cachedsc->possub; pst!=NULL && pst->type!=pst_lcaret; pst=pst->next )
prev = pst;
if ( pst==NULL && lc_cnt==0 )
/* Nothing to do */;
else if ( pst!=NULL && lc_cnt==0 ) {
if ( prev==NULL )
ci->sc->possub = pst->next;
ci->cachedsc->possub = pst->next;
else
prev->next = pst->next;
pst->next = NULL;
@ -1353,7 +1564,7 @@ return( false );
pst = chunkalloc(sizeof(PST));
pst->type = pst_lcaret;
pst->next = ci->sc->possub;
ci->sc->possub = pst;
ci->cachedsc->possub = pst;
}
if ( lc_cnt>pst->u.lcaret.cnt )
pst->u.lcaret.carets = grealloc(pst->u.lcaret.carets,lc_cnt*sizeof(int16));
@ -1364,22 +1575,141 @@ return( false );
}
#ifdef FONTFORGE_CONFIG_TYPE3
ci->sc->tile_margin = tile_margin;
ci->sc->tile_bounds = tileb;
ci->cachedsc->tile_margin = tile_margin;
ci->cachedsc->tile_bounds = tileb;
#endif
return( ret );
}
static void CI_ApplyAll(CharInfo *ci) {
int refresh_fvdi = false;
struct splinecharlist *scl;
SplineChar *cached, *sc;
SplineFont *sf = ci->sc->parent;
FontView *fvs;
for ( scl = ci->changes; scl!=NULL; scl=scl->next ) {
cached = scl->sc;
sc = sf->glyphs[cached->orig_pos];
SCPreserveState(sc,2);
if ( strcmp(cached->name,sc->name)!=0 || cached->unicodeenc!=sc->unicodeenc )
refresh_fvdi = 1;
if ( sc->name==NULL || strcmp( sc->name,cached->name )!=0 ) {
if ( sc->name!=NULL )
SFGlyphRenameFixup(sf,sc->name,cached->name);
free(sc->name); sc->name = copy(cached->name);
sc->namechanged = true;
GlyphHashFree(sf);
}
if ( sc->unicodeenc != cached->unicodeenc ) {
struct splinecharlist *scl;
int layer;
RefChar *ref;
struct altuni *alt;
/* All references need the new unicode value */
for ( scl=sc->dependents; scl!=NULL; scl=scl->next ) {
for ( layer=ly_back; layer<scl->sc->layer_cnt; ++layer )
for ( ref = scl->sc->layers[layer].refs; ref!=NULL; ref=ref->next )
if ( ref->sc==sc )
ref->unicode_enc = cached->unicodeenc;
}
/* If the current unicode enc were in the list of alt unis */
/* the user might have forgotten to remove it. So if s/he did */
/* forget, swap the altuni value with the old value */
for ( alt=cached->altuni; alt!=NULL && (alt->unienc!=cached->unicodeenc || alt->vs!=-1 || alt->fid!=0); alt=alt->next );
if ( alt!=NULL ) /* alt->unienc==new value */
alt->unienc = sc->unicodeenc;
sc->unicodeenc = cached->unicodeenc;
}
free(sc->comment); sc->comment = copy(cached->comment);
sc->unlink_rm_ovrlp_save_undo = cached->unlink_rm_ovrlp_save_undo;
sc->glyph_class = cached->glyph_class;
if ( sc->color != cached->color )
refresh_fvdi = true;
sc->color = cached->color;
free(sc->countermasks);
sc->countermask_cnt = cached->countermask_cnt;
sc->countermasks = cached->countermasks;
cached->countermasks = NULL; cached->countermask_cnt = 0;
sc->tex_height = cached->tex_height;
sc->tex_depth = cached->tex_depth;
sc->italic_correction = cached->italic_correction;
sc->top_accent_horiz = cached->top_accent_horiz;
sc->is_extended_shape = cached->is_extended_shape;
#ifdef FONTFORGE_CONFIG_DEVICETABLES
DeviceTableFree(sc->italic_adjusts);
DeviceTableFree(sc->top_accent_adjusts);
sc->italic_adjusts = cached->italic_adjusts;
sc->top_accent_adjusts = cached->top_accent_adjusts;
cached->italic_adjusts = cached->top_accent_adjusts = NULL;
#endif
GlyphVariantsFree(sc->horiz_variants);
GlyphVariantsFree(sc->vert_variants);
sc->horiz_variants = cached->horiz_variants;
sc->vert_variants = cached->vert_variants;
cached->horiz_variants = cached->vert_variants = NULL;
AltUniFree(sc->altuni);
sc->altuni = cached->altuni;
cached->altuni = NULL;
sc->lig_caret_cnt_fixed = cached->lig_caret_cnt_fixed;
PSTFree(sc->possub);
sc->possub = cached->possub;
cached->possub = NULL;
KernPairsFree(sc->kerns); KernPairsFree(sc->vkerns);
sc->kerns = cached->kerns; sc->vkerns = cached->vkerns;
cached->kerns = cached->vkerns = NULL;
#ifdef FONTFORGE_CONFIG_TYPE3
sc->tile_margin = cached->tile_margin;
sc->tile_bounds = cached->tile_bounds;
#endif
if ( !sc->changed ) {
sc->changed = true;
refresh_fvdi = true;
}
SCRefreshTitles(sc);
}
if ( ci->name_change || ci->uni_change ) {
for ( fvs=(FontView *) sf->fv; fvs!=NULL; fvs=(FontView *) fvs->b.nextsame ) {
/* Postscript encodings are by name, others are by unicode */
/* Hence slight differences in when we update the encoding */
if ( (ci->name_change && fvs->b.map->enc->psnames!=NULL ) ||
(ci->uni_change && fvs->b.map->enc->psnames==NULL )) {
fvs->b.map->enc = &custom;
FVSetTitle((FontViewBase *) fvs);
refresh_fvdi = true;
}
}
}
if ( refresh_fvdi ) {
for ( fvs=(FontView *) sf->fv; fvs!=NULL; fvs=(FontView *) fvs->b.nextsame ) {
GDrawRequestExpose(fvs->gw,NULL,false); /* Redraw info area just in case this char is selected */
GDrawRequestExpose(fvs->v,NULL,false); /* Redraw character area in case this char is on screen */
}
}
if ( ci->changes )
sf->changed = true;
}
static void CI_Finish(CharInfo *ci) {
struct splinecharlist *scl, *next;
for ( scl=ci->changes; scl!=NULL; scl=next ) {
next = scl->next;
SplineCharFree(scl->sc);
chunkfree(scl,sizeof(*scl));
}
GDrawDestroyWindow(ci->gw);
}
static int CI_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
CharInfo *ci = GDrawGetUserData(GGadgetGetWindow(g));
if ( _CI_OK(ci) )
if ( _CI_OK(ci) ) {
CI_ApplyAll(ci);
CI_Finish(ci);
}
}
return( true );
}
@ -1394,13 +1724,13 @@ static void CI_BoundsToMargin(CharInfo *ci) {
if ( err )
return;
SplineCharFindBounds(ci->sc,&b);
sprintf( buffer, "%g", b.minx-margin );
sprintf( buffer, "%g", (double)(b.minx-margin) );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMinX),buffer);
sprintf( buffer, "%g", b.miny-margin );
sprintf( buffer, "%g", (double)(b.miny-margin) );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMinY),buffer);
sprintf( buffer, "%g", b.maxx+margin );
sprintf( buffer, "%g", (double)(b.maxx+margin) );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMaxX),buffer);
sprintf( buffer, "%g", b.maxy+margin );
sprintf( buffer, "%g", (double)(b.maxy+margin) );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMaxY),buffer);
}
@ -2109,6 +2439,8 @@ return( copy(dvstr));
#endif
static void finishedit(GGadget *g, int r, int c, int wasnew);
static void kernfinishedit(GGadget *g, int r, int c, int wasnew);
static void kerninit(GGadget *g, int r);
static void enable_enum(GGadget *g, GMenuItem *mi, int r, int c);
static struct col_init simplesubsci[] = {
@ -2196,7 +2528,7 @@ static int pst2lookuptype[] = { ot_undef, gpos_single, gpos_pair, gsub_single,
gsub_alternate, gsub_multiple, gsub_ligature, 0 };
struct matrixinit mi[] = {
{ sizeof(simpleposci)/sizeof(struct col_init)-1, simpleposci, 0, NULL, NULL, NULL, finishedit },
{ sizeof(pairposci)/sizeof(struct col_init)-1, pairposci, 0, NULL, NULL, NULL, finishedit },
{ sizeof(pairposci)/sizeof(struct col_init)-1, pairposci, 0, NULL, kerninit, NULL, kernfinishedit },
{ sizeof(simplesubsci)/sizeof(struct col_init)-1, simplesubsci, 0, NULL, NULL, NULL, finishedit },
{ sizeof(altsubsci)/sizeof(struct col_init)-1, altsubsci, 0, NULL, NULL, NULL, finishedit },
{ sizeof(multsubsci)/sizeof(struct col_init)-1, multsubsci, 0, NULL, NULL, NULL, finishedit },
@ -2229,7 +2561,7 @@ return;
mi[i].ti.disabled = false;
} else {
for ( j=0; j<rows; ++j )
if ( mi[i].ti.userdata == (void *) possub[r*cols+0].u.md_ival ) {
if ( mi[i].ti.userdata == (void *) possub[j*cols+0].u.md_ival ) {
mi[i].ti.selected = false;
mi[i].ti.disabled = true;
break;
@ -2241,14 +2573,15 @@ return;
}
}
void SCSubtableDefaultSubsCheck(SplineChar *sc, struct lookup_subtable *sub, struct matrix_data *possub, int col_cnt, int r) {
void SCSubtableDefaultSubsCheck(SplineChar *sc, struct lookup_subtable *sub,
struct matrix_data *possub, int col_cnt, int r, int layer) {
FeatureScriptLangList *fl;
int lookup_type = sub->lookup->lookup_type;
SplineChar *alt;
char buffer[8];
DBounds bb;
int i;
static uint32 form_tags[] = { CHR('i','n','i','t'), CHR('m','e','d','i'), CHR('f','i','n','a'), CHR('i','s','o','l'), 0 };
real loff, roff;
if ( lookup_type == gsub_single && sub->suffix != NULL ) {
alt = SuffixCheck(sc,sub->suffix);
@ -2263,16 +2596,16 @@ return;
/* These too features are designed to crop off the left and right */
/* side bearings respectively */
if ( fl->featuretag == CHR('l','f','b','d') ) {
SplineCharFindBounds(sc,&bb);
GuessOpticalOffset(sc,layer,&loff,&roff,0);
/* Adjust horixontal positioning and horizontal advance by */
/* the left side bearing */
possub[r*col_cnt+SIM_DX].u.md_ival = -bb.minx;
possub[r*col_cnt+SIM_DX_ADV].u.md_ival = -bb.minx;
possub[r*col_cnt+SIM_DX].u.md_ival = -loff;
possub[r*col_cnt+SIM_DX_ADV].u.md_ival = -loff;
return;
} else if ( fl->featuretag == CHR('r','t','b','d') ) {
SplineCharFindBounds(sc,&bb);
GuessOpticalOffset(sc,layer,&loff,&roff,0);
/* Adjust horizontal advance by right side bearing */
possub[r*col_cnt+SIM_DX_ADV].u.md_ival = bb.maxx-sc->width;
possub[r*col_cnt+SIM_DX_ADV].u.md_ival = -roff;
return;
}
} else if ( lookup_type == gsub_single ) {
@ -2353,7 +2686,8 @@ return;
cols = GMatrixEditGetColCnt(g);
if ( possub[r*cols+0].u.md_ival!=0 ) {
if ( wasnew )
SCSubtableDefaultSubsCheck(ci->sc,(struct lookup_subtable *) possub[r*cols+0].u.md_ival, possub, cols, r);
SCSubtableDefaultSubsCheck(ci->sc,(struct lookup_subtable *) possub[r*cols+0].u.md_ival, possub,
cols, r, ci->def_layer );
return;
}
/* They asked to create a new subtable */
@ -2366,8 +2700,8 @@ return;
ti = SFSubtableListOfType(ci->sc->parent, pst2lookuptype[sel+1], false, false);
GMatrixEditSetColumnChoices(g,0,ti);
GTextInfoListFree(ti);
if ( wasnew )
SCSubtableDefaultSubsCheck(ci->sc,sub, possub, cols, r);
if ( wasnew && ci->cv!=NULL )
SCSubtableDefaultSubsCheck(ci->sc,sub, possub, cols, r, CVLayer((CharViewBase *) (ci->cv)));
} else if ( ci->old_sub!=NULL ) {
/* Restore old value */
possub[r*cols+0].u.md_ival = (intpt) ci->old_sub;
@ -2378,6 +2712,88 @@ return;
GGadgetRedraw(g);
}
static void kern_AddKP(void *data,SplineChar *left, SplineChar *right, int off) {
int *kp_offset = data;
*kp_offset = off;
}
static void kernfinishedit(GGadget *g, int r, int c, int wasnew) {
int rows;
struct matrix_data *possub;
CharInfo *ci;
int cols;
struct lookup_subtable *sub;
SplineChar *lefts[2], *rights[2];
int touch, separation, kp_offset=0;
SplineChar *osc;
if ( c==1 ) {
ci = GDrawGetUserData(GGadgetGetWindow(g));
possub = GMatrixEditGet(g, &rows);
cols = GMatrixEditGetColCnt(g);
sub = (struct lookup_subtable *) possub[r*cols+0].u.md_ival;
if ( possub[r*cols+PAIR_DX_ADV1].u.md_ival==0 &&
possub[r*cols+1].u.md_str!=NULL &&
(osc = SFGetChar(ci->sc->parent,-1,possub[r*cols+1].u.md_str))!=NULL ) {
lefts[1] = rights[1] = NULL;
if ( sub->lookup->lookup_flags & pst_r2l ) {
lefts[0] = osc;
rights[0] = ci->sc;
} else {
lefts[0] = ci->sc;
rights[0] = osc;
}
touch = sub->kerning_by_touch;
separation = sub->separation;
if ( separation==0 && !touch )
separation = 15*(osc->parent->ascent+osc->parent->descent)/100;
AutoKern2(osc->parent,ci->def_layer,lefts,rights,sub,
separation,0,touch,0,0, /* Don't bother with minkern or onlyCloser, they asked for this, they get it, whatever it may be */
kern_AddKP,&kp_offset);
possub[r*cols+PAIR_DX_ADV1].u.md_ival=kp_offset;
}
} else
finishedit(g,r,c,wasnew);
}
static int SubHasScript(uint32 script,struct lookup_subtable *sub) {
FeatureScriptLangList *f;
struct scriptlanglist *s;
if ( sub==NULL )
return(false);
for ( f = sub->lookup->features; f!=NULL; f=f->next ) {
for ( s=f->scripts; s!=NULL; s=s->next ) {
if ( s->script == script )
return( true );
}
}
return( false );
}
static void kerninit(GGadget *g, int r) {
CharInfo *ci = GDrawGetUserData(GGadgetGetWindow(g));
GMenuItem *mi = GMatrixEditGetColumnChoices(g,0);
int i,cols,rows;
struct matrix_data *possub;
uint32 script;
possub = GMatrixEditGet(g, &rows);
cols = GMatrixEditGetColCnt(g);
if ( r!=0 )
possub[r*cols+0].u.md_ival = possub[(r-1)*cols+0].u.md_ival;
else {
script = SCScriptFromUnicode(ci->sc);
for ( i=0; mi[i].ti.line || mi[i].ti.text!=NULL; ++i ) {
if ( SubHasScript(script,(struct lookup_subtable *) mi[i].ti.userdata ) )
break;
}
if ( mi[i].ti.line || mi[i].ti.text!=NULL )
possub[r*cols+0].u.md_ival = (intpt) mi[i].ti.userdata;
}
}
static void CI_DoHideUnusedSingle(CharInfo *ci) {
GGadget *pstk = GWidgetGetControl(ci->gw,CID_List+(pst_position-1)*100);
int rows, cols = GMatrixEditGetColCnt(pstk);
@ -2605,7 +3021,7 @@ return( NULL );
me->bitmap[(me->ymax-y)*me->bytes_per_line + (x-me->xmin)];
}
}
xoffset = 1 - minx + me->width + kern - other->xmin + rint(old[cols*ci->r+PAIR_DX2+coff2].u.md_ival*scale);
xoffset = 1 - minx + me->width + kern - rint(old[cols*ci->r+PAIR_DX2+coff2].u.md_ival*scale);
yoffset = 1 + maxy - rint(old[cols*ci->r+PAIR_DY2+coff2].u.md_ival*scale);
for ( y=other->ymin; y<=other->ymax; ++y ) {
for ( x=other->xmin; x<=other->xmax; ++x ) {
@ -2932,7 +3348,7 @@ GImage *NameList_GetImage(SplineFont *sf,SplineChar *sc,int def_layer,
char *subs = namelist, *pt, *start;
int ch;
if ( sc==NULL || sf==NULL )
if ( sc==NULL || sf==NULL || namelist==NULL )
return( NULL );
me = Rasterize(sc,def_layer);
ymin = me->ymin; ymax = me->ymax;
@ -2948,10 +3364,14 @@ return( NULL );
extracnt = 0;
for ( pt=subs; *pt ; ) {
start = pt;
while ( *pt!=' ' && *pt!='\0' ) ++pt;
while ( *pt!=' ' && *pt!='\0' && *pt!='(' ) ++pt;
ch = *pt; *pt = '\0';
other = SFGetChar(sf,-1, start);
*pt = ch;
if ( ch=='(' ) {
while ( *pt!=')' && *pt!='\0' ) ++pt;
if ( *pt==')' ) ++pt;
}
if ( other!=NULL ) {
if ( extracnt==0 ) width += ICON_WIDTH;
extras[extracnt] = Rasterize(other,def_layer);
@ -3050,7 +3470,7 @@ return( NULL );
return( NULL );
return( NameList_GetImage(sf,sc,def_layer,old[cols*popup_r+1].u.md_str,
sub->lookup->lookup_type<=gsub_ligature));
sub->lookup->lookup_type==gsub_ligature));
}
static GImage *_CI_GetImage(const void *_ci) {
@ -3234,6 +3654,9 @@ static int TeX_Default(GGadget *g, GEvent *e) {
isbaseline(ci->sc->unicodeenc) &&
(basesc = SFGetChar(sf,'I',NULL))!=NULL )
/* Done */;
else
basesc = ci->sc;
SplineCharFindBounds(basesc,&b);
style = MacStyleCode(sf,NULL);
@ -3492,7 +3915,7 @@ return( true );
}
static void CIFillup(CharInfo *ci) {
SplineChar *sc = ci->sc;
SplineChar *sc = ci->cachedsc!=NULL ? ci->cachedsc : ci->sc;
SplineFont *sf = sc->parent;
unichar_t *temp;
char buffer[400];
@ -3514,8 +3937,8 @@ static void CIFillup(CharInfo *ci) {
if ( ci->oldsc!=NULL && ci->oldsc->charinfo==ci )
ci->oldsc->charinfo = NULL;
sc->charinfo = ci;
ci->oldsc = sc;
ci->sc->charinfo = ci;
ci->oldsc = ci->sc;
GGadgetSetEnabled(GWidgetGetControl(ci->gw,-1), ci->enc>0 &&
((gid=ci->map->map[ci->enc-1])==-1 ||
@ -3578,14 +4001,14 @@ static void CIFillup(CharInfo *ci) {
ValDevTabToStrings(mds[pst_pair],j+PAIR_DX2+1,pst->u.pair.vr[1].adjust);
#endif
} else {
mds[pst->type][j+1].u.md_str = copy(pst->u.subs.variant);
mds[pst->type][j+1].u.md_str = SFNameList2NameUni(sf,pst->u.subs.variant);
}
}
for ( isv=0; isv<2; ++isv ) {
for ( kp=isv ? sc->vkerns : sc->kerns; kp!=NULL; kp=kp->next ) {
j = (cnts[pst_pair]++ * mi[pst_pair-1].col_cnt);
mds[pst_pair][j+0].u.md_ival = (intpt) kp->subtable;
mds[pst_pair][j+1].u.md_str = copy(kp->sc->name);
mds[pst_pair][j+1].u.md_str = SCNameUniStr(kp->sc);
#ifdef FONTFORGE_CONFIG_DEVICETABLES
if ( isv ) {
mds[pst_pair][j+PAIR_DY_ADV1].u.md_ival = kp->off;
@ -3740,18 +4163,18 @@ static void CIFillup(CharInfo *ci) {
GGadgetSetChecked(GWidgetGetControl(ci->gw,CID_IsTileMargin),margined);
if ( margined ) {
sprintf( buffer, "%g", sc->tile_margin );
sprintf( buffer, "%g", (double) sc->tile_margin );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileMargin),buffer);
CI_BoundsToMargin(ci);
} else {
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileMargin),"0");
sprintf( buffer, "%g", sc->tile_bounds.minx );
sprintf( buffer, "%g", (double) sc->tile_bounds.minx );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMinX),buffer);
sprintf( buffer, "%g", sc->tile_bounds.miny );
sprintf( buffer, "%g", (double) sc->tile_bounds.miny );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMinY),buffer);
sprintf( buffer, "%g", sc->tile_bounds.maxx );
sprintf( buffer, "%g", (double) sc->tile_bounds.maxx );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMaxX),buffer);
sprintf( buffer, "%g", sc->tile_bounds.maxy );
sprintf( buffer, "%g", (double) sc->tile_bounds.maxy );
GGadgetSetTitle8(GWidgetGetControl(ci->gw,CID_TileBBoxMaxY),buffer);
}
}
@ -3769,6 +4192,7 @@ static int CI_NextPrev(GGadget *g, GEvent *e) {
CharInfo *ci = GDrawGetUserData(GGadgetGetWindow(g));
int enc = ci->enc + GGadgetGetCid(g); /* cid is 1 for next, -1 for prev */
SplineChar *new;
struct splinecharlist *scl;
if ( enc<0 || enc>=ci->map->enccount ) {
GGadgetSetEnabled(g,false);
@ -3783,6 +4207,9 @@ return( true );
}
ci->sc = new;
ci->enc = enc;
for ( scl=ci->changes; scl!=NULL && scl->sc->orig_pos!=new->orig_pos;
scl = scl->next );
ci->cachedsc = scl==NULL ? NULL : scl->sc;
CIFillup(ci);
}
return( true );
@ -3907,7 +4334,7 @@ return;
memset(&ubox,0,sizeof(ubox));
memset(&ulabel,0,sizeof(ulabel));
ulabel[0].text = (unichar_t *) _("U_nicode Name:");
ulabel[0].text = (unichar_t *) _("Glyph _Name:");
ulabel[0].text_is_1byte = true;
ulabel[0].text_in_resource = true;
ugcd[0].gd.label = &ulabel[0];
@ -4037,7 +4464,7 @@ return;
ulabel[12].text_in_resource = true;
ugcd[12].gd.label = &ulabel[12];
ugcd[12].gd.cid = CID_UnlinkRmOverlap;
ugcd[12].gd.popup_msg = (unichar_t *) _("A few glyphs, like Aring, Ccedilla, Eogonek\nare composed of two overlapping references.\nOften it is desireable to retain the references\n(so that changes made to the base glyph are\nreflected in the composed glyph), but that\nmeans you are stuck with overlapping contours.\nThis flag means that just before saving the\nfont, fontforge will unlink the references,\nand run remove overlap on them, then just\nafter saving it will undo the operation\nthereby retaining the references.");
ugcd[12].gd.popup_msg = (unichar_t *) _("A few glyphs, like Aring, Ccedilla, Eogonek\nare composed of two overlapping references.\nOften it is desirable to retain the references\n(so that changes made to the base glyph are\nreflected in the composed glyph), but that\nmeans you are stuck with overlapping contours.\nThis flag means that just before saving the\nfont, fontforge will unlink the references,\nand run remove overlap on them, then just\nafter saving it will undo the operation\nthereby retaining the references.");
ugcd[12].creator = GCheckBoxCreate;
uhvarray[21] = &ugcd[12]; uhvarray[22] = GCD_ColSpan; uhvarray[23] = NULL;
uhvarray[24] = GCD_Glue; uhvarray[25] = GCD_Glue; uhvarray[26] = NULL;
@ -4445,7 +4872,7 @@ return;
vargcd[i][3].gd.label = &varlabel[i][3];
vargcd[i][3].gd.flags = gg_enabled|gg_visible|gg_utf8_popup;
vargcd[i][3].creator = GLabelCreate;
vargcd[i][3].gd.popup_msg = (unichar_t *) _("The italic correction of the composed glyph. Should be independant of glyph size");
vargcd[i][3].gd.popup_msg = (unichar_t *) _("The italic correction of the composed glyph. Should be independent of glyph size");
varhvarray[i][2][0] = &vargcd[i][3];
vargcd[i][4].gd.flags = gg_enabled|gg_visible|gg_utf8_popup;
@ -4744,11 +5171,10 @@ return;
mgcd[4].gd.pos.x = -25; mgcd[4].gd.pos.y = mgcd[3].gd.pos.y+3;
mgcd[4].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
mlabel[4].text = (unichar_t *) _("_Done");
mlabel[4].text = (unichar_t *) _("_Cancel");
mlabel[4].text_is_1byte = true;
mlabel[4].text_in_resource = true;
mgcd[4].gd.label = &mlabel[4];
mgcd[4].gd.mnemonic = 'C';
mgcd[4].gd.handle_controlevent = CI_Cancel;
mgcd[4].gd.cid = CID_Cancel;
mharray2[4] = GCD_Glue; mharray2[5] = &mgcd[4]; mharray2[6] = GCD_Glue; mharray2[7] = NULL;
@ -4969,7 +5395,6 @@ return;
label[i].text = (unichar_t *) _("Select Glyphs in lookup subtable");
label[i].text_is_1byte = true;
gcd[i].gd.label = &label[i];
gcd[i].gd.pos.x = 5; gcd[i].gd.pos.y = gcd[i-1].gd.pos.y+26;
gcd[i].gd.flags = gg_enabled|gg_visible;
gcd[i++].creator = GLabelCreate;
varray[j++] = &gcd[i-1]; varray[j++] = NULL;
@ -5066,7 +5491,7 @@ void CharInfoInit(void) {
static int done = 0;
int i, j;
static char **cnames[] = { newstrings, NULL };
static struct col_init *col_inits[] = { extensionpart,
static struct col_init *col_inits[] = { extensionpart, altuniinfo,
#ifdef FONTFORGE_CONFIG_DEVICETABLES
devtabci,
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2007,2008 by George Williams */
/* Copyright (C) 2007-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaedit.h"
#include "fontforge.h"
#include "uiinterface.h"
static void NClipboard_Grab(void) {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2007,2008 by George Williams */
/* Copyright (C) 2007-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include "uiinterface.h"
/* I don't care what window "owns" the X (or other UI) clipboard */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include "psfont.h"
#include <ustring.h>
#include <gkeysym.h>
@ -857,6 +857,7 @@ static void KPKPCloseup(KPData *kpd) {
k->newoff = k->kp->off;
k->kp->off = oldoff;
GDrawRequestExpose(kpd->v,NULL,false);
kpd->selected = -1;
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002-2008 by George Williams */
/* Copyright (C) 2002-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#ifndef _CursorsMustBe16x16
# define _CursorsMustBe16x16 0 /* X on Mac OSX can't handle anything bigger than 16x16 cursors (I think, it seems to manage smaller ones) */
@ -624,21 +624,21 @@ static unsigned char lbearmask_bits[] = {
0x80, 0x00, 0xf8, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe, 0x3f,
0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x0f,
0xf8, 0x0f, 0xf8, 0x0f, 0x80, 0x00};
#define logo_width 32
#define logo_height 32
static unsigned char logo_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00,
0xf0, 0x07, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00,
0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00,
0xfc, 0x3f, 0x00, 0x00, 0x9f, 0x3f, 0x00, 0x00, 0x07, 0x0f, 0x38, 0x00,
0x00, 0xc3, 0xff, 0x01, 0x00, 0x60, 0xf0, 0x1f, 0x00, 0xbc, 0xed, 0x7f,
0x80, 0x07, 0xf8, 0x7f, 0xe0, 0x6f, 0xff, 0x7f, 0xf8, 0xb7, 0xff, 0x1f,
0xfe, 0x01, 0xfe, 0x05, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0x23, 0x00,
0x80, 0x71, 0x7c, 0x00, 0x00, 0x8e, 0xff, 0x01, 0x00, 0xff, 0xff, 0x03,
0xc0, 0xdf, 0xff, 0x03, 0xc0, 0xdf, 0xff, 0x03, 0x80, 0xef, 0xff, 0x00,
0x00, 0xef, 0x3f, 0x00, 0x00, 0xec, 0x03, 0x00, 0x00, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xf0, 0x00, 0x00,
0x6c, 0xb0, 0x01, 0x00, 0xe0, 0x86, 0xfb, 0x01, 0xc0, 0x28, 0x53, 0x03,
0xd0, 0x55, 0xa7, 0x02, 0x80, 0x01, 0x06, 0x03, 0xf0, 0xdf, 0x7f, 0x02,
0xf0, 0xdf, 0x7f, 0x03, 0x00, 0x03, 0x0c, 0x02, 0x30, 0x57, 0x5d, 0x03,
0x50, 0xa6, 0x98, 0x02, 0xb0, 0x4e, 0x39, 0x03, 0x50, 0xae, 0x3a, 0x02,
0xb0, 0x4c, 0x31, 0x03, 0x50, 0x9d, 0x72, 0x02, 0xb0, 0x18, 0x65, 0x02,
0x50, 0x39, 0xe0, 0x00, 0xb0, 0x72, 0xc6, 0x19, 0x50, 0xe5, 0x97, 0x1f,
0xb0, 0x8a, 0x23, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf0, 0x3f, 0xff, 0x03, 0xe0, 0x3f, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xff, 0x03, 0xf0, 0x3f, 0xff, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define prohibition_width 16
#define prohibition_height 16

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include "splinefont.h"
#include "ustring.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2003-2008 by George Williams */
/* Copyright (C) 2003-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,13 +24,16 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include <gkeysym.h>
#include <ustring.h>
#include <ctype.h> /* must use ctype here because freetype headers include it (prior to 2.3.5) */
#include <gresource.h>
extern GBox _ggadget_Default_Box;
#define MAIN_FOREGROUND (_ggadget_Default_Box.main_foreground)
int debug_wins = dw_registers|dw_stack;
#ifndef FREETYPE_HAS_DEBUGGER
@ -49,10 +52,17 @@ void CVDebugPointPopup(CharView *cv) {
#else
#include <ft2build.h>
#include FT_FREETYPE_H
#if FREETYPE_MINOR>=2
# include <internal/internal.h>
#if defined(__MINGW32__)
# if FREETYPE_MINOR>=2
# include <freetype/internal/internal.h>
# endif
# include <freetype/truetype/ttinterp.h>
#else
# if FREETYPE_MINOR>=2
# include <internal/internal.h>
# endif
# include "ttinterp.h"
#endif
#include "ttinterp.h"
#if FREETYPE_MAJOR==2 && (FREETYPE_MINOR<3 || (FREETYPE_MINOR==3 && FREETYPE_PATCH<5))
# define PPEMX(exc) ((exc)->size->metrics.x_ppem)
@ -157,55 +167,55 @@ static void DVRegExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
y = 3+dv->ii.as - dv->reg_offtop*dv->ii.fh;
if ( exc==NULL ) {
GDrawDrawBiText8(pixmap,3,y,"<not running>",-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,"<not running>",-1,NULL,MAIN_FOREGROUND);
return;
}
sprintf( buffer, " rp0: %d", exc->GS.rp0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, " rp1: %d", exc->GS.rp1 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, " rp2: %d", exc->GS.rp2 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "loop: %ld", exc->GS.loop );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
y+=2;
sprintf( buffer, " zp0: %s", exc->GS.gep0?"Normal":"Twilight" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, " zp1: %s", exc->GS.gep1?"Normal":"Twilight" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, " zp2: %s", exc->GS.gep2?"Normal":"Twilight" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
y+=2;
sprintf( buffer, "MinDist: %.2f", exc->GS.minimum_distance/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "CvtCutin: %.2f", exc->GS.control_value_cutin/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "SingWidCut: %.2f", exc->GS.single_width_cutin/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "SingWidVal: %.2f", exc->GS.single_width_value/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
y+=2;
sprintf( buffer, "freeVec: %g,%g", (((int)exc->GS.freeVector.x<<16)>>(16+14)) + ((exc->GS.freeVector.x&0x3fff)/16384.0),
(((int)exc->GS.freeVector.y<<16)>>(16+14)) + ((exc->GS.freeVector.y&0x3fff)/16384.0) );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "projVec: %g,%g", (((int)exc->GS.projVector.x<<16)>>(16+14)) + ((exc->GS.projVector.x&0x3fff)/16384.0),
(((int)exc->GS.projVector.y<<16)>>(16+14)) + ((exc->GS.projVector.y&0x3fff)/16384.0) );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "dualVec: %g,%g", (((int)exc->GS.dualVector.x<<16)>>(16+14)) + ((exc->GS.dualVector.x&0x3fff)/16384.0),
(((int)exc->GS.dualVector.y<<16)>>(16+14)) + ((exc->GS.dualVector.y&0x3fff)/16384.0) );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
y+=2;
sprintf( buffer, "AutoFlip: %s", exc->GS.auto_flip?"True": "False" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "DeltaBase: %d", exc->GS.delta_base );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "DeltaShift: %d", exc->GS.delta_shift );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "RndState: %s",
exc->GS.round_state==TT_Round_To_Half_Grid? "To Half Grid" :
exc->GS.round_state==TT_Round_To_Grid? "To Grid" :
@ -216,25 +226,25 @@ return;
exc->GS.round_state==TT_Round_Super? "Super" :
exc->GS.round_state==TT_Round_Super_45? "Super45" :
"Unknown" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "SRndPeriod: %.2f", exc->period/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "SRndPhase: %.2f", exc->phase/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "SRndThreshold: %.2f", exc->threshold/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "InstrControl: %d", exc->GS.instruct_control );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "ScanControl: %s", exc->GS.scan_control?"True": "False" );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
sprintf( buffer, "ScanType: %d", exc->GS.scan_type );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
/* Instruction control, scan control, scan type, phase, threshold for super rounding */
y += 2;
sprintf( buffer, "Pixels/Em: %d", PPEMY(exc) );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0); y += dv->ii.fh;
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND); y += dv->ii.fh;
}
static void DVStackExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
@ -246,11 +256,11 @@ static void DVStackExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
GDrawSetFont(pixmap,dv->ii.gfont);
y = 3+dv->ii.as - dv->stack_offtop*dv->ii.fh;
if ( exc==NULL || exc->top==0 ) {
GDrawDrawBiText8(pixmap,3,y,"<empty>",-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,"<empty>",-1,NULL,MAIN_FOREGROUND);
} else {
for ( i=exc->top-1; i>=0; --i ) {
sprintf(buffer, "%3d: %3ld (%.2f)", i, exc->stack[i], exc->stack[i]/64.0 );
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,buffer,-1,NULL,MAIN_FOREGROUND);
if ( y>event->u.expose.rect.y+event->u.expose.rect.height )
break;
y += dv->ii.fh;
@ -267,7 +277,7 @@ static void DVStorageExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
GDrawSetFont(pixmap,dv->ii.gfont);
y = 3+dv->ii.as - dv->storage_offtop*dv->ii.fh;
if ( exc==NULL || exc->storeSize==0 ) {
GDrawDrawBiText8(pixmap,3,y,_("<empty>"),-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,_("<empty>"),-1,NULL,MAIN_FOREGROUND);
} else {
int n_watch;
uint8 *watches = DebuggerGetWatchStores(dv->dc,&n_watch);
@ -279,7 +289,7 @@ static void DVStorageExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
if ( i<n_watch && watches!=NULL && watches[i] && y>0 )
GDrawDrawImage(pixmap,&GIcon_Stop,NULL,3,
y-dv->ii.as-2);
GDrawDrawBiText8(pixmap,23,y,buffer,-1,NULL,0);
GDrawDrawBiText8(pixmap,23,y,buffer,-1,NULL,MAIN_FOREGROUND);
if ( y>event->u.expose.rect.y+event->u.expose.rect.height )
break;
y += dv->ii.fh;
@ -296,7 +306,7 @@ static void DVCvtExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
GDrawSetFont(pixmap,dv->ii.gfont);
y = 3+dv->ii.as;
if ( exc==NULL || exc->cvtSize==0 ) {
GDrawDrawBiText8(pixmap,3,y,_("<empty>"),-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,_("<empty>"),-1,NULL,MAIN_FOREGROUND);
} else {
int n_watch;
uint8 *watches = DebuggerGetWatchCvts(dv->dc,&n_watch);
@ -306,7 +316,7 @@ static void DVCvtExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
if ( dv->cvt_offtop+i<n_watch && watches!=NULL && watches[dv->cvt_offtop+i] && y>0 )
GDrawDrawImage(pixmap,&GIcon_Stop,NULL,3,
y-dv->ii.as-2);
GDrawDrawBiText8(pixmap,23,y,buffer,-1,NULL,0);
GDrawDrawBiText8(pixmap,23,y,buffer,-1,NULL,MAIN_FOREGROUND);
if ( y>event->u.expose.rect.y+event->u.expose.rect.height )
break;
y += dv->ii.fh;
@ -400,7 +410,7 @@ static void DVPointsVExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
else
sprintf(buffer, " : I %g,%g", (double) me.x , (double) me.y );
if ( y>0 )
GDrawDrawBiText8(pixmap,3+19,y,buffer,-1,NULL,0);
GDrawDrawBiText8(pixmap,3+19,y,buffer,-1,NULL,MAIN_FOREGROUND);
y += dv->ii.fh;
}
if ( r->contours!=NULL && i==r->contours[c] ) { /* No contours in twilight */
@ -416,25 +426,25 @@ static void DVPointsVExpose(GWindow pixmap,DebugView *dv,GEvent *event) {
if ( show_grid )
sprintf(buffer, "%3d: %c%c%c %.2f,%.2f", i,
show_twilight ? 'T' : i>=n-ph? 'F' : r->tags[i]&FT_Curve_Tag_On?'P':'C',
r->tags[i]&FT_Curve_Tag_Touch_X?'H':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'V':' ',
r->tags[i]&FT_Curve_Tag_Touch_X?'X':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'Y':' ',
(double) (me.x/dv->scalex/64.0), (double) (me.y/dv->scaley/64.0) );
else if ( show_raw )
sprintf(buffer, "%3d: %c%c%c %d,%d", i,
r->tags[i]&FT_Curve_Tag_On?'P':'C', r->tags[i]&FT_Curve_Tag_Touch_X?'H':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'V':' ',
r->tags[i]&FT_Curve_Tag_On?'P':'C', r->tags[i]&FT_Curve_Tag_Touch_X?'X':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'Y':' ',
(int) pts[i].x, (int) pts[i].y );
else
sprintf(buffer, "%3d: %c%c%c %g,%g", i,
r->tags[i]&FT_Curve_Tag_On?'P':'C', r->tags[i]&FT_Curve_Tag_Touch_X?'H':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'V':' ',
r->tags[i]&FT_Curve_Tag_On?'P':'C', r->tags[i]&FT_Curve_Tag_Touch_X?'X':' ', r->tags[i]&FT_Curve_Tag_Touch_Y?'Y':' ',
(double) me.x, (double) me.y );
if ( y>0 )
GDrawDrawBiText8(pixmap,3+19,y,buffer,-1,NULL,0);
GDrawDrawBiText8(pixmap,3+19,y,buffer,-1,NULL,MAIN_FOREGROUND);
if ( y>event->u.expose.rect.y+event->u.expose.rect.height )
break;
y += dv->ii.fh;
}
}
if ( n==0 ) {
GDrawDrawBiText8(pixmap,3,y,_("<none>"),-1,NULL,0);
GDrawDrawBiText8(pixmap,3,y,_("<none>"),-1,NULL,MAIN_FOREGROUND);
}
}
@ -711,6 +721,7 @@ static void DVFigureNewState(DebugView *dv,TT_ExecContext exc) {
cv->oldraster = cv->raster;
SplinePointListsFree(cv->b.gridfit);
cv->b.gridfit = SplineSetsFromPoints(&exc->pts,dv->scalex,dv->scaley,dv->active_refs);
DVMarkPts(dv,cv->b.gridfit);
cv->raster = DebuggerCurrentRaster(exc,cv->ft_depth);
if ( show_transformed && !show_raw && cv->raster!=NULL ) {
BasePoint me;
@ -773,7 +784,7 @@ static void DVDefaultRaster(DebugView *dv) {
}
cv->b.ft_gridfitwidth = 0;
if ( cv!=NULL )
if ( cv->v!=NULL )
GDrawRequestExpose(cv->v,NULL,false);
if ( dv->raster!=NULL )
GDrawRequestExpose(dv->raster,NULL,false);
@ -2081,7 +2092,7 @@ void CVDebugReInit(CharView *cv,int restart_debug,int dbg_fpgm) {
dv->scaley = scaley;
dv->cv = cv;
dv->layer = CVLayer((CharViewBase *) cv);
dv->dc = DebuggerCreate(cv->b.sc,dv->layer,cv->ft_pointsizey,cv->ft_pointsizex,cv->ft_dpi,dbg_fpgm,cv->ft_depth==2);
dv->dc = DebuggerCreate(cv->b.sc,dv->layer,cv->ft_pointsizey,cv->ft_pointsizex,cv->ft_dpi,dbg_fpgm,cv->ft_depth==1);
FreeType_FreeRaster(cv->raster); cv->raster = NULL;
if ( dv->dc==NULL ) {
free(dv);
@ -2226,7 +2237,7 @@ return;
} else {
dv->scalex = scalex;
dv->scaley = scaley;
DebuggerReset(dv->dc,cv->ft_pointsizey,cv->ft_pointsizex,cv->ft_dpi,dbg_fpgm,cv->ft_depth==2);
DebuggerReset(dv->dc,cv->ft_pointsizey,cv->ft_pointsizex,cv->ft_dpi,dbg_fpgm,cv->ft_depth==1);
FreeType_FreeRaster(cv->raster); cv->raster = NULL;
if (( exc = DebuggerGetEContext(dv->dc))!=NULL )
DVFigureNewState(dv,exc);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005-2008 by George Williams */
/* Copyright (C) 2005-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,20 +24,30 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include <gkeysym.h>
#include <ustring.h>
#include <stdarg.h>
extern GBox _ggadget_Default_Box;
#define MAIN_FOREGROUND (_ggadget_Default_Box.main_foreground)
#ifdef FREETYPE_HAS_DEBUGGER
#include <ft2build.h>
#include FT_FREETYPE_H
#if FREETYPE_MINOR>=2
# include <internal/internal.h>
#if defined(__MINGW32__)
# if FREETYPE_MINOR>=2
# include <freetype/internal/internal.h>
# endif
# include <freetype/truetype/ttinterp.h>
#else
# if FREETYPE_MINOR>=2
# include <internal/internal.h>
# endif
# include "ttinterp.h"
#endif
#include "ttinterp.h"
#if FREETYPE_MAJOR==2 && (FREETYPE_MINOR<3 || (FREETYPE_MINOR==3 && FREETYPE_PATCH<5))
# define PPEMX(exc) ((exc)->size->metrics.x_ppem)
@ -88,7 +98,7 @@ static void scrprintf(struct scr *scr, char *format, ... ) {
va_start(ap,format);
vsnprintf(buffer,sizeof(buffer),format,ap);
GDrawDrawBiText8(scr->pixmap,3,scr->y,buffer,-1,NULL,0);
GDrawDrawBiText8(scr->pixmap,3,scr->y,buffer,-1,NULL,MAIN_FOREGROUND);
scr->y += scr->fh;
++scr->lines;
}
@ -477,6 +487,7 @@ return(1);
scrprintf(&scr," (in zone from zp1: %s)", exc->GS.gep1?"Normal":"Twilight" );
}
scrprintf(&scr, "Pops: %d (contour index)", exc->stack[exc->top-1]);
scrprintf(&scr," (in zone from zp2: %s)", exc->GS.gep2?"Normal":"Twilight" );
scrfree(&scr,exc);
scrproj(&scr,exc);
break;
@ -529,7 +540,7 @@ return(1);
scrproj(&scr,exc);
break;
case 0x3A: case 0x3B:
scrprintf(&scr," MIAP Move Stack Indirect Relative Point");
scrprintf(&scr," MSIRP Move Stack Indirect Relative Point");
scrprintf(&scr,operator&1?" set rp0 to point":
" don't set rp0");
scrprintf(&scr,"moves point along freedom vector");
@ -654,22 +665,22 @@ return(1);
val1 = exc->stack[exc->top-1];
val2 = exc->stack[exc->top-2];
if ( operator==0x4a ) {
if ( operator==0x49 ) {
scrprintf(&scr,"Pop: %d (cur point (%.2f,%.2f))", val1,
exc->zp0.cur[val1].x/64.0,exc->zp0.cur[val1].y/64.0 );
scrprintf(&scr," (in zone from zp0: %s)", exc->GS.gep0?"Normal":"Twilight" );
scrprintf(&scr,"Pop: %d (cur point (%.2f,%.2f))", val2,
exc->zp1.cur[val2].x/64.0,exc->zp1.cur[val2].y/64.0 );
exc->zp1.cur[val1].x/64.0,exc->zp1.cur[val1].y/64.0 );
scrprintf(&scr," (in zone from zp1: %s)", exc->GS.gep1?"Normal":"Twilight" );
scrprintf(&scr,"Pop: %d (cur point (%.2f,%.2f))", val2,
exc->zp0.cur[val2].x/64.0,exc->zp0.cur[val2].y/64.0 );
scrprintf(&scr," (in zone from zp0: %s)", exc->GS.gep0?"Normal":"Twilight" );
scrprintf(&scr, "projVec: %g,%g", (((int)exc->GS.projVector.x<<16)>>(16+14)) + ((exc->GS.projVector.x&0x3fff)/16384.0),
(((int)exc->GS.projVector.y<<16)>>(16+14)) + ((exc->GS.projVector.y&0x3fff)/16384.0) );
} else {
scrprintf(&scr,"Pop: %d (orig point (%.2f,%.2f))", val1,
exc->zp0.org[val1].x/64.0,exc->zp0.org[val1].y/64.0 );
scrprintf(&scr," (in zone from zp0: %s)", exc->GS.gep0?"Normal":"Twilight" );
scrprintf(&scr,"Pop: %d (orig point (%.2f,%.2f))", val2,
exc->zp1.org[val2].x/64.0,exc->zp1.org[val2].y/64.0 );
exc->zp1.org[val1].x/64.0,exc->zp1.org[val1].y/64.0 );
scrprintf(&scr," (in zone from zp1: %s)", exc->GS.gep1?"Normal":"Twilight" );
scrprintf(&scr,"Pop: %d (orig point (%.2f,%.2f))", val2,
exc->zp0.org[val2].x/64.0,exc->zp0.org[val2].y/64.0 );
scrprintf(&scr," (in zone from zp0: %s)", exc->GS.gep0?"Normal":"Twilight" );
scrprintf(&scr, "dualVec: %g,%g", (((int)exc->GS.dualVector.x<<16)>>(16+14)) + ((exc->GS.dualVector.x&0x3fff)/16384.0),
(((int)exc->GS.dualVector.y<<16)>>(16+14)) + ((exc->GS.dualVector.y&0x3fff)/16384.0) );
}
@ -971,13 +982,13 @@ return(1);
if ( (val1&&0xff)==0xff )
scrprintf(&scr,"set dropout control for all ppem");
else
scrprintf(&scr,"set dropout control for ppem < %d", (val1&0xff));
scrprintf(&scr,"set dropout control for ppem <= %d", (val1&0xff));
}
if ( val1&0x800 ) {
if ( (val1&&0xff)==0xff )
scrprintf(&scr,"<I can't figure this combination out>");
else
scrprintf(&scr,"unset dropout control unless ppem < %d", (val1&0xff));
scrprintf(&scr,"unset dropout control unless ppem <= %d", (val1&0xff));
}
if ( val1&0x200 )
scrprintf(&scr,"set dropout control if glyph rotated");
@ -1226,7 +1237,368 @@ void DVCreateGloss(DebugView *dv) {
GDrawSetVisible(dv->gloss,true);
}
/* ************************************************************************** */
/* Variant of the gloss window: Mark the points to show what the next */
/* instruction will do to them. (Change (usually move) them, or use them */
/* or ignore them */
/* ************************************************************************** */
static SplinePoint *FindPoint(SplineSet *ss,int ptnum) {
SplineSet *spl;
SplinePoint *sp;
for ( spl=ss; spl!=NULL ; spl=spl->next ) {
for ( sp = spl->first; ; ) {
if ( sp->ttfindex==ptnum || sp->nextcpindex==ptnum )
return( sp );
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
return( NULL );
}
static void SetBasisPoint(SplineSet *ss, int ptnum) {
SplinePoint *sp = FindPoint(ss,ptnum);
if ( sp==NULL )
return;
/* A roundx point or flexx nextcp means this is the reference */
/* point, etc. */
if ( sp->ttfindex==ptnum )
sp->roundx = true;
else
sp->flexx = true;
}
static void SetChangingPoint(SplineSet *ss, int ptnum) {
SplinePoint *sp = FindPoint(ss,ptnum);
if ( sp==NULL )
return;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
if ( sp->ttfindex==ptnum )
sp->selected = true;
else
sp->flexy = true;
}
void DVMarkPts(DebugView *dv,SplineSet *ss) {
TT_ExecContext exc = DebuggerGetEContext(dv->dc);
long changing_point, basis_point;
int i,cnt,top;
int operator;
SplineSet *spl;
SplinePoint *sp;
for ( spl=ss; spl!=NULL ; spl=spl->next ) {
for ( sp = spl->first; ; ) {
sp->selected = false;
sp->roundx = sp->roundy = false;
sp->flexx = sp->flexy = false;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
/* A roundx point or flexx nextcp means this is the reference */
/* point, etc. */
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
if ( exc==NULL )
return; /* Not running */
if ( exc->IP>=exc->codeSize || exc->code==NULL )
return; /* At end */
operator = ((uint8 *) exc->code)[exc->IP];
changing_point = -1;
basis_point = -1;
if ( operator>=0xc0 && operator <= 0xdf ) {
/* MDRP */
if ( exc->GS.gep1 ) /* No good way to mark twilight points, so only mark normal ones */
changing_point = exc->stack[exc->top-1];
if ( exc->GS.gep0 )
basis_point = exc->GS.rp0;
} else if ( operator>=0xe0 && operator <= 0xff ) {
/* MIRP */
if ( exc->GS.gep1 ) /* No good way to mark twilight points, so only mark normal ones */
changing_point = exc->stack[exc->top-2];
if ( exc->GS.gep0 )
basis_point = exc->GS.rp0;
} else if ( operator>=0xb0 && operator <= 0xbf ) {
/* Push */
} else switch ( operator ) {
case 0xf:
/* Moves point to intersection of two lines */
if ( exc->GS.gep2 ) /* No good way to mark twilight points, so only mark normal ones */
changing_point = exc->stack[exc->top-5];
if ( exc->GS.gep0 ) {
SetBasisPoint(ss,exc->stack[exc->top-4]);
SetBasisPoint(ss,exc->stack[exc->top-3]);
}
if ( exc->GS.gep1 ) {
SetBasisPoint(ss,exc->stack[exc->top-2]);
SetBasisPoint(ss,exc->stack[exc->top-1]);
}
break;
case 0x10: case 0x11: case 0x12:
/* Set Reference Point ? */
basis_point = exc->stack[exc->top-1];
break;
case 0x27:
/* Align Points */
if ( exc->GS.gep0 )
SetChangingPoint(ss,exc->stack[exc->top-1]);
if ( exc->GS.gep1 )
SetChangingPoint(ss,exc->stack[exc->top-2]);
break;
case 0x28:
/* Untouch point */
if ( exc->GS.gep0 )
changing_point = exc->stack[exc->top-1];
break;
case 0x2E:
/* Touch point */
if ( exc->GS.gep0 )
changing_point = exc->stack[exc->top-1];
break;
case 0x2F:
/* Round and Touch point */
if ( exc->GS.gep0 )
changing_point = exc->stack[exc->top-1];
break;
case 0x30:
/* Interpolate Untouched Points in y */
if ( exc->GS.gep2 ) {
TT_GlyphZoneRec *r = &exc->pts;
for ( spl=ss; spl!=NULL ; spl=spl->next ) {
for ( sp = spl->first; ; ) {
if ( sp->ttfindex<r->n_points &&
!(r->tags[sp->ttfindex]&FT_Curve_Tag_Touch_Y) )
sp->selected = true;
if ( sp->nextcpindex<r->n_points &&
!(r->tags[sp->nextcpindex]&FT_Curve_Tag_Touch_Y) )
sp->flexy = true;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
}
break;
case 0x31:
/* Interpolate Untouched Points in x */
if ( exc->GS.gep2 ) {
TT_GlyphZoneRec *r = &exc->pts;
for ( spl=ss; spl!=NULL ; spl=spl->next ) {
for ( sp = spl->first; ; ) {
if ( sp->ttfindex<r->n_points &&
!(r->tags[sp->ttfindex]&FT_Curve_Tag_Touch_X) )
sp->selected = true;
if ( sp->nextcpindex<r->n_points &&
!(r->tags[sp->nextcpindex]&FT_Curve_Tag_Touch_X) )
sp->flexy = true;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
}
break;
case 0x32: case 0x33:
/* Shift point by amount ref point shifted */
if ( operator==0x33 ) {
if ( exc->GS.gep0 )
basis_point = exc->GS.rp1;
} else {
if ( exc->GS.gep1 )
basis_point = exc->GS.rp2;
}
if ( exc->GS.gep2 )
for ( i=1; i<=exc->GS.loop && i<exc->top; ++i ) {
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x34: case 0x35:
/* Shift contour by amount ref point shifted */
if ( operator==0x35 ) {
if ( exc->GS.gep0 )
basis_point = exc->stack[exc->GS.rp1];
} else {
if ( exc->GS.gep1 )
basis_point = exc->stack[exc->GS.rp2];
}
if ( exc->GS.gep2 ) {
for ( spl=ss, i=exc->stack[exc->top-1]; i>0 && spl!=NULL; --i, spl=spl->next );
if ( spl!=NULL ) {
for ( sp = spl->first; ; ) {
if ( sp->ttfindex<0xfff0 )
sp->selected = true;
if ( sp->nextcpindex<0xfff0 )
sp->flexy = true;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
}
break;
case 0x36: case 0x37:
if ( operator==0x37 ) {
if ( exc->GS.gep0 )
basis_point = exc->stack[exc->GS.rp1];
} else {
if ( exc->GS.gep1 )
basis_point = exc->stack[exc->GS.rp2];
}
if ( exc->stack[exc->top-1] ) {
for ( spl=ss; spl!=NULL; spl=spl->next ) {
for ( sp = spl->first; ; ) {
if ( sp->ttfindex<0xfff0 )
sp->selected = true;
if ( sp->nextcpindex<0xfff0 )
sp->flexy = true;
/* I reuse these flags. A "selected" point is one which will be */
/* moved by the instruction. A "flexy"ed point means its nextcp */
/* will be moved by the next instruction */
if ( sp->next==NULL )
break;
sp = sp->next->to;
if ( sp==spl->first )
break;
}
}
}
break;
case 0x38:
/* Shift point by pixel amount */
if ( exc->GS.gep2 ) {
for ( i=2; i<=exc->GS.loop+1 && i<exc->top; ++i )
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x39:
/* Interpolated Point */
if ( exc->GS.gep0 )
SetBasisPoint(ss,exc->GS.rp1);
if ( exc->GS.gep1 )
SetBasisPoint(ss,exc->GS.rp2);
if ( exc->GS.gep2 ) {
for ( i=1; i<=exc->GS.loop+1 && i<exc->top; ++i )
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x3A: case 0x3B:
/* MSIRP Move Stack Indirect Relative Point */
if ( exc->GS.gep1 )
changing_point = exc->stack[exc->top-2];
if ( exc->GS.gep0 )
basis_point = exc->GS.rp0;
break;
case 0x3C:
/* Align to Reference Point */
if ( exc->GS.gep0 )
basis_point = exc->GS.rp0;
if ( exc->GS.gep1 )
for ( i=1; i<=exc->GS.loop && i<exc->top; ++i ) {
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x3E: case 0x3F:
/* MIAP Move Indirect Absolute Point */
if ( exc->GS.gep0 )
changing_point = exc->stack[exc->top-2];
break;
case 0x46: case 0x47:
/* Get current/original point coord projected on projection vector */
if ( exc->GS.gep2 )
basis_point = exc->stack[exc->top-1];
break;
case 0x48:
/* Sets coordinate from stack using proj & free vectors */
if ( exc->GS.gep2 )
changing_point = exc->stack[exc->top-2];
break;
case 0x49: case 0x4A:
/* Measure Distance */
if ( exc->GS.gep0 )
SetBasisPoint( ss, exc->stack[exc->top-1] );
if ( exc->GS.gep1 )
SetBasisPoint( ss, exc->stack[exc->top-2] );
break;
case 0x5D: case 0x71: case 0x72:
case 0x73: case 0x74: case 0x75:
/* Delta Point */
cnt = exc->stack[exc->top-1];
for ( i=0; i<cnt; ++i ) {
if ( 2*i+3 > exc->top )
break;
if ( exc->GS.gep0 )
SetChangingPoint(ss, exc->stack[exc->top-2-2*i]);
}
break;
case 0x80:
/* Flip Points */
if ( exc->GS.gep0 )
for ( i=1; i<=exc->GS.loop && i<exc->top; ++i ) {
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x81: case 0x82:
i = exc->stack[exc->top-1];
top = exc->stack[exc->top-2];
if ( exc->GS.gep0 )
for ( ; i<=top; ++i ) {
SetChangingPoint(ss,exc->stack[exc->top-i]);
}
break;
case 0x06: case 0x07:
case 0x08: case 0x09:
case 0x86: case 0x87:
/* Sets vector from line */
if ( exc->GS.gep1 )
SetBasisPoint(ss,exc->stack[exc->top-2]);
if ( exc->GS.gep2 )
SetBasisPoint(ss,exc->stack[exc->top-1]);
break;
default:
/* Many instructions don't refer to points */
break;
}
if ( changing_point!=-1 )
SetChangingPoint(ss,changing_point);
if ( basis_point!=-1 )
SetBasisPoint(ss,basis_point);
}
#else
void DVCreateGloss(DebugView *dv) {
}
void DVMarkPts(DebugView *dv,SplineSet *ss) {
}
#endif /* Has Debugger */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -30,7 +30,6 @@
#include <string.h>
#include "gfile.h"
#include <time.h>
#include <pwd.h>
#include "ustring.h"
#include "gio.h"
#include "gicons.h"
@ -78,10 +77,11 @@ int _ExportEPS(FILE *eps,SplineChar *sc, int layer, int preview) {
time_t now;
struct tm *tm;
int ret;
char *oldloc;
char oldloc[24];
const char *author = GetAuthor();
oldloc = setlocale(LC_NUMERIC,"C");
strcpy( oldloc,setlocale(LC_NUMERIC,NULL) );
setlocale(LC_NUMERIC,"C");
fprintf( eps, "%%!PS-Adobe-3.0 EPSF-3.0\n" );
SplineCharLayerFindBounds(sc,layer,&b);
@ -153,13 +153,15 @@ int _ExportPDF(FILE *pdf,SplineChar *sc,int layer) {
time_t now;
struct tm *tm;
int ret;
char *oldloc;
char oldloc[24];
int _objlocs[8], xrefloc, streamstart, streamlength, resid, nextobj;
int *objlocs = _objlocs;
const char *author = GetAuthor();
int i;
oldloc = setlocale(LC_NUMERIC,"C");
SFUntickAll(sc->parent);
strcpy( oldloc,setlocale(LC_NUMERIC,NULL) );
setlocale(LC_NUMERIC,"C");
fprintf( pdf, "%%PDF-1.4\n%%\201\342\202\203\n" ); /* Header comment + binary comment */
/* Every document contains a catalog which points to a page tree, which */
@ -289,13 +291,14 @@ return( ret );
int _ExportPlate(FILE *plate,SplineChar *sc,int layer) {
char *oldloc;
char oldloc[24];
int do_open;
SplineSet *ss;
spiro_cp *spiros;
int i, ret;
oldloc = setlocale(LC_NUMERIC,"C");
strcpy( oldloc,setlocale(LC_NUMERIC,NULL) );
setlocale(LC_NUMERIC,"C");
/* Output closed contours first, then open. Plate files can only handle */
/* one open contour (I think) and it must be at the end */
fprintf( plate, "(plate\n" );
@ -497,7 +500,7 @@ int ExportImage(char *filename,SplineChar *sc, int layer, int format, int pixels
void *freetypecontext;
double emsize = sc->parent->ascent+sc->parent->descent;
if ( autohint_before_rasterize && sc->changedsincelasthinted && !sc->manualhints )
if ( autohint_before_generate && sc->changedsincelasthinted && !sc->manualhints )
SplineCharAutoHint(sc,layer,NULL);
memset(&gi,'\0', sizeof(gi));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,13 +24,12 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include <locale.h>
#include <string.h>
#include "gfile.h"
#include <time.h>
#include <pwd.h>
#include "ustring.h"
#include "gio.h"
#include "gicons.h"
@ -217,7 +216,7 @@ return( 0 );
if ( !AskSizeBits(&pixelsize,&bitsperpixel) )
return( 0 );
}
if ( autohint_before_rasterize && sc->changedsincelasthinted && !sc->manualhints )
if ( autohint_before_generate && sc->changedsincelasthinted && !sc->manualhints )
SplineCharAutoHint(sc,layer,NULL);
return( ExportImage(filename,sc, layer, format, pixelsize, bitsperpixel));
}
@ -247,10 +246,11 @@ static GTextInfo formats[] = {
{ (unichar_t *) N_("Glif"), NULL, 0, 0, (void *) 3, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("PDF"), NULL, 0, 0, (void *) 4, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("Raph's plate"), NULL, 0, 0, (void *) 5, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("X Bitmap"), NULL, 0, 0, (void *) 6, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("BMP"), NULL, 0, 0, (void *) 7, 0, 0, 0, 0, 0, 0, 0, 1 },
#define BITMAP_FORMAT_START 6
{ (unichar_t *) N_("X Bitmap"), NULL, 0, 0, (void *) BITMAP_FORMAT_START, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("BMP"), NULL, 0, 0, (void *) (BITMAP_FORMAT_START+1), 0, 0, 0, 0, 0, 0, 0, 1 },
#ifndef _NO_LIBPNG
{ (unichar_t *) N_("png"), NULL, 0, 0, (void *) 8, 0, 0, 0, 0, 0, 0, 0, 1 },
{ (unichar_t *) N_("png"), NULL, 0, 0, (void *) (BITMAP_FORMAT_START+2), 0, 0, 0, 0, 0, 0, 0, 1 },
#endif
{ NULL }};
static int last_format = 0;
@ -262,7 +262,7 @@ static void DoExport(struct gfc_data *d,unichar_t *path) {
temp = cu_copy(path);
last_format = format = (intpt) (GGadgetGetListItemSelected(d->format)->userdata);
if ( d->bc )
last_format += 5;
last_format += BITMAP_FORMAT_START;
if ( d->bc!=NULL )
good = BCExportXBM(temp,d->bc,format);
else if ( format==0 )
@ -278,7 +278,7 @@ static void DoExport(struct gfc_data *d,unichar_t *path) {
else if ( format==5 )
good = ExportPlate(temp,d->sc,d->layer);
else if ( format<fv_pythonbase )
good = ExportXBM(temp,d->sc,d->layer,format-5);
good = ExportXBM(temp,d->sc,d->layer,format-BITMAP_FORMAT_START);
#ifndef _NO_PYTHON
else if ( format>=fv_pythonbase )
PyFF_SCExport(d->sc,format-fv_pythonbase,temp,d->layer);
@ -431,7 +431,7 @@ return( false );
struct gfc_data *d = GDrawGetUserData(gw);
GFileChooserPopupCheck(d->gfc,event);
} else if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button==4 || event->u.mouse.button==5) ) {
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) {
struct gfc_data *d = GDrawGetUserData(gw);
return( GGadgetDispatchEvent((GGadget *) (d->gfc),event));
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,9 +24,11 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#undef DEBUG_FREEHAND
const int min_line_cnt = 10; /* line segments must be at least this many datapoints to be distinguished */
const int min_line_len = 20; /* line segments must be at least this many pixels to be distinguished */
const double line_wobble = 1.0; /* data must not stray more than this many pixels from the true line */
@ -54,12 +56,14 @@ typedef struct tracedata {
} TraceData;
static void TraceDataFree(TraceData *td) {
TraceData *next;
TraceData *next, *first=td;
while ( td!=NULL ) {
next = td->next;
chunkfree(td,sizeof(TraceData));
td = next;
if ( td==first )
break;
}
}
@ -112,7 +116,7 @@ return;
new->xtilt = event->u.mouse.xtilt;
new->ytilt = event->u.mouse.ytilt;
new->wasconstrained = (event->u.mouse.state&ksm_shift)?1:0;
#if 0
#ifdef DEBUG_FREEHAND
printf( "(%d,%d) (%g,%g) %d %d\n", event->u.mouse.x, event->u.mouse.y,
new->here.x, new->here.y, new->pressure, new->time );
if ( new->prev!=NULL && new->time<new->prev->time )
@ -379,6 +383,7 @@ static void TraceMassage(TraceData *head, TraceData *end) {
head->use_as_pt = end->use_as_pt = true;
}
#if 0
static void MakeExtremum(SplinePoint *cur,enum extreme extremum) {
double len;
/* If we decided this point should be an exteme point, then make sure */
@ -426,6 +431,7 @@ return;
}
}
}
#endif
static bigreal Trace_Factor(void *_cv,Spline *spline, real t) {
CharView *cv = (CharView *) _cv;
@ -470,6 +476,44 @@ return( ((p-si->pressure1)*si->radius2 + (si->pressure2-p)*si->radius)/
(si->radius*(si->pressure2-si->pressure1)) );
}
static void TraceFigureCPs(SplinePoint *last,SplinePoint *cur,TraceData *tlast,TraceData *tcur) {
TraceData *pt;
last->nonextcp = false; cur->noprevcp=false;
for ( pt=tlast; !pt->use_as_pt ; pt=pt->prev );
if ( pt->online ) {
last->nextcp.x = last->me.x + ( tlast->x-pt->x );
last->nextcp.y = last->me.y + ( tlast->y-pt->y );
} else if ( tlast->extremum==e_xmin || tlast->extremum==e_xmax || tlast->extremum==e_xflat ) {
last->nextcp.x = last->me.x;
last->nextcp.y = cur->me.y>last->me.y ? last->me.y+1 : last->me.y-1;
} else if ( tlast->extremum==e_ymin || tlast->extremum==e_ymax || tlast->extremum==e_yflat ) {
last->nextcp.y = last->me.y;
last->nextcp.x = cur->me.x>last->me.x ? last->me.x+1 : last->me.x-1;
} else if ( !last->noprevcp && !tlast->constrained_corner ) {
last->nextcp.x = last->me.x + (last->me.x - last->prevcp.x);
last->nextcp.y = last->me.y + (last->me.y - last->prevcp.y);
} else
last->nonextcp = true;
if ( tcur->online ) {
for ( pt=tcur; !pt->use_as_pt ; pt=pt->next );
cur->prevcp.x = cur->me.x + ( tcur->x-pt->x );
cur->prevcp.y = cur->me.y + ( tcur->y-pt->y );
} else if ( tcur->extremum==e_xmin || tcur->extremum==e_xmax || tcur->extremum==e_xflat ) {
cur->prevcp.x = cur->me.x;
cur->prevcp.y = last->me.y>cur->me.y ? cur->me.y+1 : cur->me.y-1;
} else if ( tcur->extremum==e_ymin || tcur->extremum==e_ymax || tcur->extremum==e_yflat ) {
cur->prevcp.y = cur->me.y;
cur->prevcp.x = last->me.x>cur->me.x ? cur->me.x+1 : cur->me.x-1;
} else if ( !cur->nonextcp && !tcur->constrained_corner ) { /* Only happens at end of a closed contour */
cur->prevcp.x = cur->me.x + (cur->me.x - cur->nextcp.x);
cur->prevcp.y = cur->me.y + (cur->me.y - cur->nextcp.y);
} else
cur->noprevcp = true;
}
static SplineSet *TraceCurve(CharView *cv) {
TraceData *head = cv->freehand.head, *pt, *base, *e;
SplineSet *spl;
@ -507,7 +551,7 @@ static SplineSet *TraceCurve(CharView *cv) {
/* Find the middle of a range of extremum points, that'll be the one we want */
for ( base=head->next; base!=NULL; base = base->next ) {
if ( base->extremum>=e_xmin ) {
tot = 0;
tot = 1;
if ( base->extremum>=e_ymin ) {
for ( pt=base->next ; pt->extremum>=e_ymin ; pt = pt->next ) ++tot;
} else {
@ -515,7 +559,7 @@ static SplineSet *TraceCurve(CharView *cv) {
}
tot /= 2;
e = pt;
for ( pt=base->next, i=0 ; i<tot ; pt = pt->next, ++i );
for ( pt=base, i=0 ; i<tot ; pt = pt->next, ++i );
pt->use_as_pt = true;
base = e;
}
@ -556,19 +600,26 @@ static SplineSet *TraceCurve(CharView *cv) {
/* Splice things together */
spl = chunkalloc(sizeof(SplineSet));
spl->first = last = SplinePointCreate(head->here.x,head->here.y);
spl->first = last = SplinePointCreate(rint(head->here.x),rint(head->here.y));
last->ptindex = 0;
for ( base=head; base!=NULL && base->next!=NULL; base = pt ) {
for ( pt=base->next; !pt->use_as_pt ; pt=pt->next );
cur = SplinePointCreate(pt->here.x,pt->here.y);
cur = SplinePointCreate(rint(pt->here.x),rint(pt->here.y));
cur->ptindex = pt->num;
/* even if we are order2, do everything in order3, and then convert */
/* when they raise the pen */
if ( base->next->online || base->next==pt )
SplineMake(last,cur,false);
else
ApproximateSplineFromPoints(last,cur,mids+base->num+1,pt->num-base->num-1,false);
else {
TraceFigureCPs(last,cur,base,pt);
if ( !last->nonextcp && !cur->noprevcp )
ApproximateSplineFromPointsSlopes(last,cur,mids+base->num+1,pt->num-base->num-1,false);
else {
last->nonextcp = false; cur->noprevcp=false;
ApproximateSplineFromPoints(last,cur,mids+base->num+1,pt->num-base->num-1,false);
}
}
last = cur;
}
spl->last = last;
@ -583,6 +634,7 @@ static SplineSet *TraceCurve(CharView *cv) {
spl->last->pointtype = pt_corner;
else
spl->last->pointtype = pt_curve;
#if 0
if ( spl->first->next!=NULL ) {
pt = head;
for ( cur=spl->first->next->to; cur->next!=NULL ; cur = cur->next->to ) {
@ -592,7 +644,7 @@ static SplineSet *TraceCurve(CharView *cv) {
if ( !cur->nonextcp && !cur->noprevcp )
cur->pointtype = pt_curve;
else
cur->pointtype = pt_tangent;
cur->pointtype = pt_corner;
SPWeightedAverageCps(cur);
while ( pt!=NULL && pt->num<cur->ptindex ) pt=pt->next;
if ( pt!=NULL && pt->extremum!=e_none )
@ -608,6 +660,7 @@ static SplineSet *TraceCurve(CharView *cv) {
mids+cur->ptindex+1,
cur->next->to->ptindex-cur->ptindex-1,false);
}
#endif
free(mids);
@ -615,7 +668,7 @@ static SplineSet *TraceCurve(CharView *cv) {
if ( si->stroke_type!=si_centerline ) {
si->factor = ( si->pressure1==si->pressure2 ) ? NULL : Trace_Factor;
si->data = cv;
spl->next = SplineSetStroke(spl,si,cv->b.sc);
spl->next = SplineSetStroke(spl,si,false);
}
return( spl );
}
@ -722,6 +775,7 @@ return;
SplineRefigure(trace->first->prev);
}
#if 0
struct statistics {
double xmean, ymean, xsd, ysd;
int cnt;
@ -761,13 +815,20 @@ static void TraceStatistics(TraceData *mid,struct statistics *stats) {
stats->ysd = sqrt(x2-x*x/cnt)/(cnt-1);
}
}
#endif
static void TraceDataCleanup(CharView *cv) {
TraceData *mid, *next, *prev;
static int TraceDataCleanup(CharView *cv) {
TraceData *mid, *next;
int cnt=0;
#if 0
TraceData *prev;
struct statistics stats;
#endif
for ( mid = cv->freehand.head; mid!=NULL; mid=next ) {
++cnt;
next = mid->next;
#if 0
TraceStatistics(mid,&stats);
if (( mid->here.x < stats.xmean-3*stats.xsd ||
mid->here.x > stats.xmean+3*stats.xsd ||
@ -778,8 +839,11 @@ static void TraceDataCleanup(CharView *cv) {
prev->next = next;
next->prev = prev;
chunkfree(mid,sizeof(TraceData));
--cnt;
}
#endif
}
return( cnt );
}
void CVMouseDownFreeHand(CharView *cv, GEvent *event) {
@ -791,7 +855,7 @@ void CVMouseDownFreeHand(CharView *cv, GEvent *event) {
cv->freehand.current_trace = chunkalloc(sizeof(SplinePointList));
cv->freehand.current_trace->first = cv->freehand.current_trace->last =
SplinePointCreate(cv->freehand.head->here.x,cv->freehand.head->here.y);
SplinePointCreate(rint(cv->freehand.head->here.x),rint(cv->freehand.head->here.y));
}
void CVMouseMoveFreeHand(CharView *cv, GEvent *event) {
@ -800,7 +864,7 @@ void CVMouseMoveFreeHand(CharView *cv, GEvent *event) {
BasePoint *here;
TraceDataFromEvent(cv,event);
/* I used to do the full processing here to get an path. But that took */
/* I used to do the full processing here to get a path. But that took */
/* too long to process them and we appeared to get events out of order */
/* from the wacom tablet */
last = cv->freehand.current_trace->last;
@ -808,56 +872,18 @@ void CVMouseMoveFreeHand(CharView *cv, GEvent *event) {
if ( (dx=here->x-last->me.x)<0 ) dx = -dx;
if ( (dy=here->y-last->me.y)<0 ) dy = -dy;
if ( (dx+dy)*cv->scale > 4 ) {
SplineMake3(last,SplinePointCreate(here->x,here->y));
SplineMake3(last,SplinePointCreate(rint(here->x),rint(here->y)));
cv->freehand.current_trace->last = last->next->to;
GDrawRequestExpose(cv->v,NULL,false);
}
}
void CVMouseUpFreeHand(CharView *cv, GEvent *event) {
TraceDataCleanup(cv);
if ( event->u.chr.state&ksm_meta )
TraceDataClose(cv,event);
else {
SplinePointListsFree(cv->freehand.current_trace);
cv->freehand.current_trace = TraceCurve(cv);
}
if ( cv->freehand.current_trace!=NULL ) {
CVPreserveState((CharViewBase *) cv);
if ( cv->b.layerheads[cv->b.drawmode]->order2 )
cv->freehand.current_trace = SplineSetsTTFApprox(cv->freehand.current_trace);
if ( CVFreeHandInfo()->stroke_type==si_centerline ) {
cv->freehand.current_trace->next = cv->b.layerheads[cv->b.drawmode]->splines;
cv->b.layerheads[cv->b.drawmode]->splines = cv->freehand.current_trace;
} else {
SplineSet *ss = cv->freehand.current_trace;
while ( ss->next!=NULL )
ss = ss->next;
ss->next = cv->b.layerheads[cv->b.drawmode]->splines;
#if 0 /* This branch is correct */
cv->b.layerheads[cv->b.drawmode]->splines = cv->freehand.current_trace->next;
cv->freehand.current_trace->next = NULL;
SplinePointListsFree(cv->freehand.current_trace);
#else /* Debug!!!! */
cv->b.layerheads[cv->b.drawmode]->splines = cv->freehand.current_trace;
#endif
}
cv->freehand.current_trace = NULL;
}
TraceDataFree(cv->freehand.head);
cv->freehand.head = cv->freehand.last = NULL;
CVCharChangedUpdate(&cv->b);
fflush( stdout );
}
#if 0
void RepeatFromFile(CharView *cv) {
#ifdef DEBUG_FREEHAND
static void RepeatFromFile(CharView *cv) {
FILE *foo = fopen("mousemove","r");
/*char buffer[100];*/
GEvent e;
int x,y,p;
int x,y,p,t;
if ( foo==NULL )
return;
@ -866,13 +892,13 @@ return;
e.w = cv->v;
e.type = et_mousedown;
fscanf(foo,"(%d,%d) (%*g,%*g) %d\n", &x, &y, &p);
e.u.mouse.x = x; e.u.mouse.y = y; e.u.mouse.pressure = p;
fscanf(foo,"(%d,%d) (%*g,%*g) %d %d\n", &x, &y, &p, &t);
e.u.mouse.x = x; e.u.mouse.y = y; e.u.mouse.pressure = p; e.u.mouse.time = t;
CVMouseDownFreeHand(cv,&e);
e.type = et_mousemove;
while ( fscanf(foo,"(%d,%d) (%*g,%*g) %d\n", &x, &y, &p)==3 ) {
e.u.mouse.x = x; e.u.mouse.y = y; e.u.mouse.pressure = p;
while ( fscanf(foo,"(%d,%d) (%*g,%*g) %d %d\n", &x, &y, &p, &t)==4 ) {
e.u.mouse.x = x; e.u.mouse.y = y; e.u.mouse.pressure = p; e.u.mouse.time = t;
CVMouseMoveFreeHand(cv,&e);
}
@ -881,3 +907,62 @@ return;
fclose(foo);
}
#endif
void CVMouseUpFreeHand(CharView *cv, GEvent *event) {
TraceData *head = cv->freehand.head;
TraceData *last;
double dx, dy;
#ifdef DEBUG_FREEHAND
if ( event->u.mouse.clicks>1 ) {
TraceDataFree(cv->freehand.head);
cv->freehand.head = cv->freehand.last = NULL;
RepeatFromFile(cv);
return;
}
#endif
if ( head==NULL )
return;
if ( TraceDataCleanup(cv)>=4 ) {
/* If there are fewer than 4 points then assume they made a mistake */
/* (or intended a double click) and just ignore the path */
last = cv->freehand.last;
if ( (dx=head->x-last->x)<0 ) dx = -dx;
if ( (dy=head->y-last->y)<0 ) dy = -dy;
if (( event->u.chr.state&ksm_meta ) || (dx+dy)*cv->scale > 4 )
TraceDataClose(cv,event);
else {
SplinePointListsFree(cv->freehand.current_trace);
cv->freehand.current_trace = TraceCurve(cv);
}
if ( cv->freehand.current_trace!=NULL ) {
CVPreserveState((CharViewBase *) cv);
if ( cv->b.layerheads[cv->b.drawmode]->order2 )
cv->freehand.current_trace = SplineSetsTTFApprox(cv->freehand.current_trace);
if ( CVFreeHandInfo()->stroke_type==si_centerline ) {
cv->freehand.current_trace->next = cv->b.layerheads[cv->b.drawmode]->splines;
cv->b.layerheads[cv->b.drawmode]->splines = cv->freehand.current_trace;
} else {
SplineSet *ss = cv->freehand.current_trace;
while ( ss->next!=NULL )
ss = ss->next;
ss->next = cv->b.layerheads[cv->b.drawmode]->splines;
cv->b.layerheads[cv->b.drawmode]->splines = cv->freehand.current_trace->next;
cv->freehand.current_trace->next = NULL;
/*SplinePointListsFree(cv->freehand.current_trace);*/
}
cv->freehand.current_trace = NULL;
}
} else {
SplinePointListsFree(cv->freehand.current_trace);
cv->freehand.current_trace = NULL;
}
TraceDataFree(cv->freehand.head);
cv->freehand.head = cv->freehand.last = NULL;
CVCharChangedUpdate(&cv->b);
#ifdef DEBUG_FREEHAND
fflush( stdout );
#endif
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <ustring.h>
#include <math.h>
#include <utype.h>
@ -233,12 +233,12 @@ return( true ); /* Didn't really change */
for ( i=0; i<6; ++i )
ref->transform[i] = trans[i];
SplinePointListsFree(ref->layers[0].splines);
ref->layers[0].splines = SplinePointListTransform(SplinePointListCopy(ref->sc->layers[ly_fore].splines),trans,true);
ref->layers[0].splines = SplinePointListTransform(SplinePointListCopy(ref->sc->layers[ly_fore].splines),trans,tpt_AllPoints);
spl = NULL;
if ( ref->layers[0].splines!=NULL )
for ( spl = ref->layers[0].splines; spl->next!=NULL; spl = spl->next );
for ( subref = ref->sc->layers[ly_fore].refs; subref!=NULL; subref=subref->next ) {
new = SplinePointListTransform(SplinePointListCopy(subref->layers[0].splines),trans,true);
new = SplinePointListTransform(SplinePointListCopy(subref->layers[0].splines),trans,tpt_AllPoints);
if ( spl==NULL )
ref->layers[0].splines = new;
else
@ -903,6 +903,11 @@ static void AI_Display(GIData *ci,AnchorPoint *ap) {
unichar_t uval[40];
AnchorPoint *aps;
if ( ap==NULL) {
SCUpdateAll(ci->sc);
return;
}
ci->ap = ap;
for ( aps=ci->sc->anchor; aps!=NULL; aps=aps->next )
aps->selected = false;
@ -964,7 +969,7 @@ static int AI_Ok(GGadget *g, GEvent *e);
static int AI_Delete(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
GIData *ci = GDrawGetUserData(GGadgetGetWindow(g));
AnchorPoint *ap, *prev;
AnchorPoint *ap, *prev, *delete_it;
prev=NULL;
for ( ap=ci->sc->anchor; ap!=ci->ap; ap=ap->next )
@ -977,14 +982,34 @@ static int AI_Delete(GGadget *g, GEvent *e) {
return( true );
}
}
ap = ci->ap->next;
if ( prev==NULL )
ci->sc->anchor = ap;
else
prev->next = ap;
ci->ap->next = NULL;
AnchorPointsFree(ci->ap);
AI_Display(ci,ap);
delete_it = ci->ap;
if ((prev == NULL) && (ci->ap->next == NULL)) {
ci->sc->anchor = NULL;
AnchorPointsFree(delete_it);
AI_Ok(g,e);
SCUpdateAll(ci->sc);
}
else if (ci->ap->next == NULL) {
prev->next = NULL;
AnchorPointsFree(delete_it);
AI_Display(ci,prev);
}
else if (prev == NULL) {
ci->sc->anchor = delete_it->next;
delete_it->next = NULL;
AnchorPointsFree(delete_it);
AI_Display(ci,ci->sc->anchor);
}
else {
prev->next = delete_it->next;
delete_it->next = NULL;
AnchorPointsFree(delete_it);
AI_Display(ci,prev->next);
}
_CVCharChangedUpdate(&ci->cv->b,2);
}
return( true );
}
@ -2313,8 +2338,8 @@ return( true );
diff.x = cursp->prevcp.x+dx - cursp->me.x;
diff.y = cursp->prevcp.y+dy - cursp->me.y;
BP_HVForce(&diff);
dx = diff.x - (cursp->me.x - cursp->prevcp.x);
dy = diff.y - (cursp->me.y - cursp->prevcp.y);
dx = diff.x - (cursp->prevcp.x - cursp->me.x);
dy = diff.y - (cursp->prevcp.y - cursp->me.y);
}
cursp->prevcp.x += dx;
cursp->prevcp.y += dy;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001-2008 by George Williams */
/* Copyright (C) 2001-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,12 +24,12 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <ustring.h>
#include <gkeysym.h>
#include <math.h>
int gridfit_dpi=72, gridfit_depth=2; float gridfit_pointsizey=12, gridfit_pointsizex=12;
int gridfit_dpi=72, gridfit_depth=1; float gridfit_pointsizey=12, gridfit_pointsizex=12;
int gridfit_x_sameas_y = true;
static int last_fpgm = false;
@ -67,7 +67,7 @@ return;
cv->ft_pointsizey, cv->ft_pointsizex, cv->ft_dpi, cv->ft_depth );
cv->b.gridfit = FreeType_GridFitChar(single_glyph_context,cv->b.sc->orig_pos,
cv->ft_pointsizey, cv->ft_pointsizex, cv->ft_dpi, &cv->b.ft_gridfitwidth,
cv->b.sc, cv->ft_depth );
cv->b.sc, cv->ft_depth, true );
FreeTypeFreeContext(single_glyph_context);
GDrawRequestExpose(cv->v,NULL,false);
@ -115,8 +115,8 @@ static int FtPpem_OK(GGadget *g, GEvent *e) {
ptsizex = ptsize;
else
ptsizex = GetReal8(fsd->gw,CID_PointSizeX,_("Pointsize X"),&err);
_dpi = GetInt8(fsd->gw,CID_DPI,_("D_PI:"),&err);
_depth = GGadgetIsChecked(GWidgetGetControl(fsd->gw,CID_BW)) ? 2 : 8;
_dpi = GetInt8(fsd->gw,CID_DPI,_("DPI"),&err);
_depth = GGadgetIsChecked(GWidgetGetControl(fsd->gw,CID_BW)) ? 1 : 8;
if ( err )
return(true);
@ -137,11 +137,7 @@ return(true);
CVDebugReInit(cv,true,last_fpgm);
else {
cv->show_ft_results = true;
if ( cv->show_ft_results )
CVGridFitChar(cv);
else {
GDrawRequestExpose(cv->v,NULL,false);
}
CVGridFitChar(cv);
}
CVLayersSet(cv);
fsd->done = true;
@ -334,7 +330,7 @@ void CVFtPpemDlg(CharView *cv,int debug) {
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 20; gcd[k].gd.pos.y = 14+31;
gcd[k].gd.flags = gridfit_depth==2 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
gcd[k].gd.flags = gridfit_depth==1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
gcd[k].gd.cid = CID_BW;
gcd[k++].creator = GRadioCreate;
varray[r][0] = &gcd[k-1]; varray[r][1] = GCD_HPad10;
@ -344,7 +340,7 @@ void CVFtPpemDlg(CharView *cv,int debug) {
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 80; gcd[k].gd.pos.y = gcd[9].gd.pos.y;
gcd[k].gd.flags = gridfit_depth!=2 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
gcd[k].gd.flags = gridfit_depth!=1 ? (gg_enabled|gg_visible|gg_cb_on) : (gg_enabled|gg_visible);
gcd[k++].creator = GRadioCreate;
varray[r][2] = &gcd[k-1]; varray[r++][3] = NULL;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include "ustring.h"
#include <math.h>
@ -40,7 +40,8 @@
#define CID_Overlap 1010
#define CID_Count 1011
#define CID_MovePoints 1012
#define CID_TopBox 1013
#define CID_RegenHM 1013
#define CID_TopBox 1014
typedef struct reviewhintdata {
unsigned int done: 1;
@ -253,29 +254,38 @@ return( true );
return( true );
}
static void Do_OKRegen(ReviewHintData *hd) {
SplineChar *sc = hd->cv->b.sc;
StemInfo *curh = sc->hstem, *curv = sc->vstem;
int do_regen = GGadgetIsChecked(GWidgetGetControl(hd->gw,CID_RegenHM));
/* We go backwards here, but not for long. The point is to go back to */
/* the original hint state so we can preserve it, now that we know we*/
/* are going to modify it */
sc->hstem = hd->oldh; sc->vstem = hd->oldv;
SCPreserveHints(sc,CVLayer((CharViewBase *) hd->cv));
sc->hstem = curh; sc->vstem = curv;
StemInfosFree(hd->oldh);
StemInfosFree(hd->oldv);
if ( hd->lastactive!=NULL )
hd->lastactive->active = false;
if ( hd->changed ) {
SCClearHintMasks(hd->cv->b.sc,CVLayer((CharViewBase *) (hd->cv)),true);
if ( do_regen )
SCFigureHintMasks(hd->cv->b.sc,CVLayer((CharViewBase *) (hd->cv)));
}
/* Everything else got done as we went along... */
SCOutOfDateBackground(hd->cv->b.sc);
SCUpdateAll(hd->cv->b.sc);
SCHintsChanged(hd->cv->b.sc);
hd->done = true;
}
static int RH_OK(GGadget *g, GEvent *e) {
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) {
ReviewHintData *hd = GDrawGetUserData(GGadgetGetWindow(g));
SplineChar *sc = hd->cv->b.sc;
StemInfo *curh = sc->hstem, *curv = sc->vstem;
/* We go backwards here, but not for long. The point is to go back to */
/* the original hint state so we can preserve it, now that we know we*/
/* are going to modify it */
sc->hstem = hd->oldh; sc->vstem = hd->oldv;
SCPreserveHints(sc,CVLayer((CharViewBase *) hd->cv));
sc->hstem = curh; sc->vstem = curv;
StemInfosFree(hd->oldh);
StemInfosFree(hd->oldv);
if ( hd->lastactive!=NULL )
hd->lastactive->active = false;
if ( hd->changed )
SCClearHintMasks(hd->cv->b.sc,CVLayer((CharViewBase *) (hd->cv)),true);
/* Everything else got done as we went along... */
SCOutOfDateBackground(hd->cv->b.sc);
SCUpdateAll(hd->cv->b.sc);
SCHintsChanged(hd->cv->b.sc);
hd->done = true;
Do_OKRegen(hd);
}
return( true );
}
@ -387,10 +397,11 @@ void CVReviewHints(CharView *cv) {
GRect pos;
GWindow gw;
GWindowAttrs wattrs;
GGadgetCreateData gcd[17], *harray1[5], *harray2[6], *harray3[6], *harray4[6],
*varray[6][2], boxes[7], *barray[5][6];
GTextInfo label[17];
GGadgetCreateData gcd[18], *harray1[6], *harray2[6], *harray3[6], *harray4[6],
*varray[7][2], boxes[8], *barray[6][6];
GTextInfo label[18];
static ReviewHintData hd;
int k;
hd.done = false;
hd.cv = cv;
@ -413,173 +424,162 @@ void CVReviewHints(CharView *cv) {
memset(&gcd,0,sizeof(gcd));
memset(&boxes,0,sizeof(boxes));
label[0].text = (unichar_t *) _("_Base:");
label[0].text_is_1byte = true;
label[0].text_in_resource = true;
gcd[0].gd.label = &label[0];
gcd[0].gd.pos.x = 5; gcd[0].gd.pos.y = 14+17+5+3;
gcd[0].gd.flags = gg_enabled|gg_visible;
gcd[0].creator = GLabelCreate;
harray1[0] = &gcd[0];
k=0;
gcd[1].gd.pos.x = 37; gcd[1].gd.pos.y = gcd[0].gd.pos.y-3; gcd[1].gd.pos.width = 40;
gcd[1].gd.flags = gg_enabled|gg_visible;
gcd[1].gd.cid = CID_Base;
gcd[1].gd.handle_controlevent = RH_TextChanged;
gcd[1].creator = GTextFieldCreate;
harray1[1] = &gcd[1];
label[k].text = (unichar_t *) _("_HStem");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on;
gcd[k].gd.cid = CID_HStem;
gcd[k].gd.handle_controlevent = RH_HVStem;
gcd[k].creator = GRadioCreate;
harray2[0] = &gcd[k++];
label[2].text = (unichar_t *) _("_Size:");
label[2].text_is_1byte = true;
label[2].text_in_resource = true;
gcd[2].gd.label = &label[2];
gcd[2].gd.pos.x = 90; gcd[2].gd.pos.y = gcd[0].gd.pos.y;
gcd[2].gd.flags = gg_enabled|gg_visible;
gcd[2].creator = GLabelCreate;
harray1[2] = &gcd[2];
label[k].text = (unichar_t *) _("_VStem");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].gd.cid = CID_VStem;
gcd[k].gd.handle_controlevent = RH_HVStem;
gcd[k].creator = GRadioCreate;
harray2[1] = &gcd[k++];
gcd[3].gd.pos.x = 120; gcd[3].gd.pos.y = gcd[1].gd.pos.y; gcd[3].gd.pos.width = 40;
gcd[3].gd.flags = gg_enabled|gg_visible;
gcd[3].gd.cid = CID_Width;
gcd[3].gd.handle_controlevent = RH_TextChanged;
gcd[3].creator = GTextFieldCreate;
harray1[3] = &gcd[3]; harray1[4] = GCD_Glue; harray1[5] = NULL;
label[k].text = (unichar_t *) "999/999 hstem3";
label[k].text_is_1byte = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].gd.cid = CID_Count;
gcd[k].creator = GLabelCreate;
harray2[2] = GCD_HPad10; harray2[3] = &gcd[k++]; harray2[4] = GCD_Glue; harray2[5] = NULL;
gcd[4].gd.pos.x = 20-3; gcd[4].gd.pos.y = 14+17+37+14+60;
gcd[4].gd.pos.width = -1; gcd[4].gd.pos.height = 0;
gcd[4].gd.flags = gg_visible | gg_enabled | gg_but_default;
label[4].text = (unichar_t *) _("_OK");
label[4].text_is_1byte = true;
label[4].text_in_resource = true;
gcd[4].gd.mnemonic = 'O';
gcd[4].gd.label = &label[4];
gcd[4].gd.handle_controlevent = RH_OK;
gcd[4].creator = GButtonCreate;
barray[3][0] = GCD_Glue; barray[3][1] = &gcd[4]; barray[3][2] = GCD_Glue;
label[k].text = (unichar_t *) _("_Move Points");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible|gg_utf8_popup;
gcd[k].gd.cid = CID_MovePoints;
gcd[k].gd.popup_msg = (unichar_t *) _("When the hint's position is changed\nadjust the postion of any points\nwhich lie on that hint");
gcd[k].creator = GCheckBoxCreate;
harray3[0] = &gcd[k++]; harray3[1] = GCD_Glue; harray3[2] = NULL;
gcd[5].gd.pos.x = -20; gcd[5].gd.pos.y = gcd[4].gd.pos.y+3;
gcd[5].gd.pos.width = -1; gcd[5].gd.pos.height = 0;
gcd[5].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
label[5].text = (unichar_t *) _("_Cancel");
label[5].text_is_1byte = true;
label[5].text_in_resource = true;
gcd[5].gd.label = &label[5];
gcd[5].gd.mnemonic = 'C';
gcd[5].gd.handle_controlevent = RH_Cancel;
gcd[5].creator = GButtonCreate;
barray[3][3] = &gcd[5]; barray[3][4] = GCD_Glue; barray[3][5] = NULL;
label[k].text = (unichar_t *) _("_Base:");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = 14+17+5+3;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].creator = GLabelCreate;
harray1[0] = &gcd[k++];
label[6].text = (unichar_t *) _("_HStem");
label[6].text_is_1byte = true;
label[6].text_in_resource = true;
gcd[6].gd.label = &label[6];
gcd[6].gd.pos.x = 3; gcd[6].gd.pos.y = 2;
gcd[6].gd.flags = gg_enabled|gg_visible|gg_cb_on;
gcd[6].gd.cid = CID_HStem;
gcd[6].gd.handle_controlevent = RH_HVStem;
gcd[6].creator = GRadioCreate;
harray2[0] = &gcd[6];
gcd[k].gd.pos.width = 40;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].gd.cid = CID_Base;
gcd[k].gd.handle_controlevent = RH_TextChanged;
gcd[k].creator = GTextFieldCreate;
harray1[1] = &gcd[k++];
label[7].text = (unichar_t *) _("_VStem");
label[7].text_is_1byte = true;
label[7].text_in_resource = true;
gcd[7].gd.label = &label[7];
gcd[7].gd.pos.x = 60; gcd[7].gd.pos.y = 2;
gcd[7].gd.flags = gg_enabled|gg_visible;
gcd[7].gd.cid = CID_VStem;
gcd[7].gd.handle_controlevent = RH_HVStem;
gcd[7].creator = GRadioCreate;
harray2[1] = &gcd[7];
label[k].text = (unichar_t *) _("_Size:");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].creator = GLabelCreate;
harray1[2] = &gcd[k++];
gcd[8].gd.pos.x = 5; gcd[8].gd.pos.y = 14+17+31+14+30;
gcd[8].gd.pos.width = 170-10;
gcd[8].gd.flags = gg_enabled|gg_visible;
gcd[8].creator = GLineCreate;
barray[1][0] = GCD_Glue; barray[1][1] = &gcd[8]; barray[1][2] = barray[1][3] = GCD_ColSpan; barray[1][4] = GCD_Glue; barray[1][5] = NULL;
gcd[k].gd.pos.width = 40;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].gd.cid = CID_Width;
gcd[k].gd.handle_controlevent = RH_TextChanged;
gcd[k].creator = GTextFieldCreate;
harray1[3] = &gcd[k++]; harray1[4] = GCD_Glue; harray1[5] = NULL;
gcd[9].gd.pos.x = 20; gcd[9].gd.pos.y = 14+17+14+33;
gcd[9].gd.pos.width = -1; gcd[9].gd.pos.height = 0;
gcd[9].gd.flags = gg_visible | gg_enabled;
label[9].text = (unichar_t *) _("Cr_eate");
label[9].text_is_1byte = true;
label[9].text_in_resource = true;
gcd[9].gd.mnemonic = 'e';
gcd[9].gd.label = &label[9];
gcd[9].gd.cid = CID_Add;
gcd[9].gd.handle_controlevent = RH_Add;
gcd[9].creator = GButtonCreate;
barray[0][0] = GCD_Glue; barray[0][1] = &gcd[9]; barray[0][2] = GCD_Glue;
gcd[k].gd.flags = gg_visible | gg_enabled;
label[k].text = (unichar_t *) "Overlaps another hint";
label[k].text_is_1byte = true;
label[k].fg = 0xff0000; label[k].bg = COLOR_DEFAULT; /* Doesn't work, needs to be in box */
gcd[k].gd.label = &label[k];
gcd[k].gd.cid = CID_Overlap;
gcd[k].creator = GLabelCreate;
harray4[0] = GCD_Glue; harray4[1] = &gcd[k++]; harray4[2] = GCD_Glue; harray4[3] = NULL;
gcd[10].gd.pos.x = -20; gcd[10].gd.pos.y = gcd[9].gd.pos.y;
gcd[10].gd.pos.width = -1; gcd[10].gd.pos.height = 0;
gcd[10].gd.flags = gg_visible | gg_enabled;
label[10].text = (unichar_t *) _("Re_move");
label[10].text_is_1byte = true;
label[10].text_in_resource = true;
gcd[10].gd.label = &label[10];
gcd[10].gd.mnemonic = 'R';
gcd[10].gd.cid = CID_Remove;
gcd[10].gd.handle_controlevent = RH_Remove;
gcd[10].creator = GButtonCreate;
barray[0][3] = &gcd[10]; barray[0][4] = GCD_Glue; barray[0][5] = NULL;
gcd[11].gd.pos.x = 20; gcd[11].gd.pos.y = 14+17+37+14+30;
gcd[11].gd.pos.width = -1; gcd[11].gd.pos.height = 0;
gcd[11].gd.flags = gg_visible | gg_enabled;
label[11].text = (unichar_t *) _("< _Prev");
label[11].text_is_1byte = true;
label[11].text_in_resource = true;
gcd[11].gd.mnemonic = 'P';
gcd[11].gd.label = &label[11];
gcd[11].gd.cid = CID_Prev;
gcd[11].gd.handle_controlevent = RH_NextPrev;
gcd[11].creator = GButtonCreate;
barray[2][0] = GCD_Glue; barray[2][1] = &gcd[11]; barray[2][2] = GCD_Glue;
gcd[k].gd.flags = gg_visible | gg_enabled;
label[k].text = (unichar_t *) _("Cr_eate");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.cid = CID_Add;
gcd[k].gd.handle_controlevent = RH_Add;
gcd[k].creator = GButtonCreate;
barray[0][0] = GCD_Glue; barray[0][1] = &gcd[k++]; barray[0][2] = GCD_Glue;
gcd[12].gd.pos.x = -20; gcd[12].gd.pos.y = 14+17+37+14+30;
gcd[12].gd.pos.width = -1; gcd[12].gd.pos.height = 0;
gcd[12].gd.flags = gg_visible | gg_enabled;
label[12].text = (unichar_t *) _("_Next >");
label[12].text_is_1byte = true;
label[12].text_in_resource = true;
gcd[12].gd.label = &label[12];
gcd[12].gd.mnemonic = 'N';
gcd[12].gd.cid = CID_Next;
gcd[12].gd.handle_controlevent = RH_NextPrev;
gcd[12].creator = GButtonCreate;
barray[2][3] = &gcd[12]; barray[2][4] = GCD_Glue; barray[2][5] = NULL;
barray[4][0] = NULL;
gcd[k].gd.flags = gg_visible | gg_enabled;
label[k].text = (unichar_t *) _("Re_move");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.cid = CID_Remove;
gcd[k].gd.handle_controlevent = RH_Remove;
gcd[k].creator = GButtonCreate;
barray[0][3] = &gcd[k++]; barray[0][4] = GCD_Glue; barray[0][5] = NULL;
gcd[13].gd.pos.x = 66; gcd[13].gd.pos.y = 14+17+30;
gcd[13].gd.flags = gg_visible | gg_enabled;
label[13].text = (unichar_t *) "Overlap";
label[13].text_is_1byte = true;
label[13].fg = 0xff0000; label[13].bg = COLOR_DEFAULT; /* Doesn't work, needs to be in box */
gcd[13].gd.label = &label[13];
gcd[13].gd.cid = CID_Overlap;
gcd[13].creator = GLabelCreate;
harray4[0] = GCD_Glue; harray4[1] = &gcd[13]; harray4[2] = GCD_Glue; harray4[3] = NULL;
gcd[k].gd.pos.width = 170-10;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].creator = GLineCreate;
barray[1][0] = GCD_Glue; barray[1][1] = &gcd[k++]; barray[1][2] = barray[1][3] = GCD_ColSpan; barray[1][4] = GCD_Glue; barray[1][5] = NULL;
label[14].text = (unichar_t *) "999/999 hstem3";
label[14].text_is_1byte = true;
gcd[14].gd.label = &label[14];
gcd[14].gd.pos.x = 115; gcd[14].gd.pos.y = 2+3;
gcd[14].gd.flags = gg_enabled|gg_visible;
gcd[14].gd.cid = CID_Count;
gcd[14].creator = GLabelCreate;
harray2[2] = GCD_HPad10; harray2[3] = &gcd[14]; harray2[4] = GCD_Glue; harray2[5] = NULL;
gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
label[k].text = (unichar_t *) _("< _Prev");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.cid = CID_Prev;
gcd[k].gd.popup_msg = (unichar_t *) _("Previous Hint.");
gcd[k].gd.handle_controlevent = RH_NextPrev;
gcd[k].creator = GButtonCreate;
barray[2][0] = GCD_Glue; barray[2][1] = &gcd[k++]; barray[2][2] = GCD_Glue;
label[15].text = (unichar_t *) _("_Move Points");
label[15].text_is_1byte = true;
label[15].text_in_resource = true;
gcd[15].gd.label = &label[15];
gcd[15].gd.pos.x = 3; gcd[15].gd.pos.y = 12+5+3;
gcd[15].gd.flags = gg_enabled|gg_visible|gg_utf8_popup;
gcd[15].gd.cid = CID_MovePoints;
gcd[15].gd.popup_msg = (unichar_t *) _("When the hint's position is changed\nadjust the postion of any points\nwhich lie on that hint");
gcd[15].creator = GCheckBoxCreate;
harray3[0] = &gcd[15]; harray3[1] = GCD_Glue; harray3[2] = NULL;
gcd[k].gd.flags = gg_visible | gg_enabled | gg_utf8_popup;
label[k].text = (unichar_t *) _("_Next >");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.cid = CID_Next;
gcd[k].gd.popup_msg = (unichar_t *) _("Next Hint.");
gcd[k].gd.handle_controlevent = RH_NextPrev;
gcd[k].creator = GButtonCreate;
barray[2][3] = &gcd[k++]; barray[2][4] = GCD_Glue; barray[2][5] = NULL;
label[k].text = (unichar_t *) _("Regenerate Hint Substitution Points");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on|gg_utf8_popup;
gcd[k].gd.cid = CID_RegenHM;
gcd[k].gd.popup_msg = (unichar_t *) _("If you have made any changes to the hints,\nthen in addition to changing the glyph's hints\nrefigure it's hint masks and substitution points.");
gcd[k].creator = GCheckBoxCreate;
barray[3][0] = &gcd[k++]; barray[3][1] = barray[3][2] = barray[3][3] = barray[3][4] = GCD_ColSpan; barray[3][5] = NULL;
gcd[k].gd.flags = gg_visible | gg_enabled;
label[k].text = (unichar_t *) _("_OK");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.handle_controlevent = RH_OK;
gcd[k].creator = GButtonCreate;
barray[4][0] = GCD_Glue; barray[4][1] = &gcd[k++]; barray[4][2] = GCD_Glue;
gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_cancel;
label[k].text = (unichar_t *) _("_Cancel");
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.handle_controlevent = RH_Cancel;
gcd[k].creator = GButtonCreate;
barray[4][3] = &gcd[k++]; barray[4][4] = GCD_Glue; barray[4][5] = NULL;
barray[5][0] = NULL;
boxes[2].gd.flags = gg_enabled|gg_visible;
boxes[2].gd.u.boxelements = harray2;
@ -624,8 +624,10 @@ void CVReviewHints(CharView *cv) {
GHVBoxSetExpandableCol(boxes[5].ret,gb_expandglue);
GHVBoxSetExpandableCol(boxes[6].ret,gb_expandglue);
GHVBoxFitWindow(boxes[0].ret);
} else
} else {
gw = hd.gw;
GDrawSetTransientFor(gw,(GWindow) -1);
}
if ( cv->b.sc->hstem==NULL && cv->b.sc->vstem==NULL )
hd.active = NULL;
else if ( cv->b.sc->hstem!=NULL && cv->b.sc->vstem!=NULL ) {
@ -871,6 +873,7 @@ void CVCreateHint(CharView *cv,int ishstem,int preservehints) {
sprintf( buffer, "%g", (double) (ishstem ? cv->p.cy : cv->p.cx) );
uc_strcpy(ubuf,buffer);
GGadgetSetTitle(GWidgetGetControl(gw,CID_Base),ubuf);
GDrawSetTransientFor(gw,(GWindow) -1);
}
GGadgetSetTitle8(GWidgetGetControl(gw,CID_Label),
ishstem ? _("Create Horizontal Stem Hint") :

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -281,7 +281,7 @@ return;
memset(transform,0,sizeof(transform));
transform[0] = 1; transform[3] = -1;
transform[5] = 800;
head = SplinePointListTransform(head,transform,true);
head = SplinePointListTransform(head,transform,tpt_AllPoints);
/* After doing the above flip, the contours appear oriented acording to my*/
/* conventions */
@ -953,8 +953,10 @@ void SCAddScaleImage(SplineChar *sc,GImage *image,int doclear, int layer) {
image = ImageAlterClut(image);
scale = (sc->parent->ascent+sc->parent->descent)/(real) GImageGetHeight(image);
if ( doclear )
ImageListsFree(sc->layers[layer].images); sc->layers[layer].images = NULL;
if ( doclear ) {
ImageListsFree(sc->layers[layer].images);
sc->layers[layer].images = NULL;
}
SCInsertImage(sc,image,scale,sc->parent->ascent,0,layer);
}
@ -1116,6 +1118,7 @@ return( false );
++tot;
}
}
closedir(dir);
if ( tot==0 )
ff_post_error(_("Nothing Loaded"),_("Nothing Loaded"));
return( true );

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#include <sys/types.h>
#include <dirent.h>
@ -60,6 +60,7 @@ return;
fclose(plate);
}
#ifndef _NO_LIBXML
static void ImportSVG(CharView *cv,char *path) {
SCImportSVG(cv->b.sc,CVLayer((CharViewBase *) cv),path,NULL,0,false);
}
@ -67,6 +68,7 @@ static void ImportSVG(CharView *cv,char *path) {
static void ImportGlif(CharView *cv,char *path) {
SCImportGlif(cv->b.sc,CVLayer((CharViewBase *) cv),path,NULL,0,false);
}
#endif
static void ImportFig(CharView *cv,char *path) {
SCImportFig(cv->b.sc,CVLayer((CharViewBase *) cv),path,false);
@ -264,14 +266,14 @@ return( true );
}
enum psstrokeflags Ps_StrokeFlagsDlg(void) {
static enum psstrokeflags oldflags = sf_correctdir|sf_removeoverlap/*|sf_handle_eraser*/;
static enum psstrokeflags oldflags = sf_correctdir/*|sf_removeoverlap|sf_handle_eraser*/;
GRect pos;
GWindow gw;
GWindowAttrs wattrs;
GGadgetCreateData gcd[11], boxes[4], *hvarray[7][2], *barray[10];
GTextInfo label[11];
int done = false;
int k, rm_k, he_k, cd_k;
int k, he_k, cd_k;
if ( no_windowing_ui )
return( oldflags );
@ -319,6 +321,7 @@ return( oldflags );
gcd[k++].creator = GCheckBoxCreate;
hvarray[1][0] = &gcd[k-1]; hvarray[1][1] = NULL;
#if 0
rm_k = k;
label[k].text = (unichar_t *) _("Cleanup Self Intersect");
label[k].text_is_1byte = true;
@ -329,6 +332,7 @@ return( oldflags );
gcd[k].gd.popup_msg = (unichar_t *) _("When FontForge detects that an expanded stroke will self-intersect,\nthen setting this option will cause it to try to make things nice\nby removing the intersections");
gcd[k++].creator = GCheckBoxCreate;
hvarray[2][0] = &gcd[k-1]; hvarray[2][1] = NULL;
#endif
he_k = k;
label[k].text = (unichar_t *) _("Handle Erasers");
@ -339,8 +343,8 @@ return( oldflags );
(oldflags&sf_handle_eraser?gg_cb_on:0);
gcd[k].gd.popup_msg = (unichar_t *) _("Certain programs use pens with white ink as erasers\nIf you select (blacken) this checkbox, FontForge will\nattempt to simulate that.");
gcd[k++].creator = GCheckBoxCreate;
hvarray[3][0] = &gcd[k-1]; hvarray[3][1] = NULL;
hvarray[4][0] = GCD_Glue; hvarray[4][1] = NULL;
hvarray[2][0] = &gcd[k-1]; hvarray[2][1] = NULL;
hvarray[3][0] = GCD_Glue; hvarray[3][1] = NULL;
gcd[k].gd.pos.x = (PSSF_Width-GIntGetResource(_NUM_Buttonsize))/2; gcd[k].gd.pos.y = PSSF_Height-34;
gcd[k].gd.flags = gg_visible | gg_enabled | gg_but_default;
@ -355,8 +359,8 @@ return( oldflags );
boxes[2].gd.flags = gg_enabled | gg_visible;
boxes[2].gd.u.boxelements = barray;
boxes[2].creator = GHBoxCreate;
hvarray[5][0] = &boxes[2]; hvarray[5][1] = NULL;
hvarray[6][0] = NULL;
hvarray[4][0] = &boxes[2]; hvarray[4][1] = NULL;
hvarray[5][0] = NULL;
boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2;
boxes[0].gd.flags = gg_enabled | gg_visible;
@ -377,8 +381,10 @@ return( oldflags );
oldflags = 0;
if ( GGadgetIsChecked(gcd[cd_k].ret) )
oldflags |= sf_correctdir;
#if 0
if ( GGadgetIsChecked(gcd[rm_k].ret) )
oldflags |= sf_removeoverlap;
#endif
if ( GGadgetIsChecked(gcd[he_k].ret) )
oldflags |= sf_handle_eraser;
GDrawDestroyWindow(gw);
@ -597,7 +603,7 @@ return( false );
struct gfc_data *d = GDrawGetUserData(gw);
GFileChooserPopupCheck(d->gfc,event);
} else if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button==4 || event->u.mouse.button==5) ) {
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) {
struct gfc_data *d = GDrawGetUserData(gw);
return( GGadgetDispatchEvent((GGadget *) (d->gfc),event));
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,7 +24,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <math.h>
#if defined(KNIFE_CONTINUOUS) /* Use this code to do cuts as we move along. Probably a bad idea, let's wait till the end */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000-2008 by George Williams */
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -24,11 +24,12 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pfaeditui.h"
#include "fontforgeui.h"
#include <utype.h>
#include <math.h>
int stop_at_join = false;
extern int interpCPsOnMotion;
int CVAnySel(CharView *cv, int *anyp, int *anyr, int *anyi, int *anya) {
int anypoints = 0, anyrefs=0, anyimages=0, anyanchor=0;
@ -608,9 +609,11 @@ return;
SetCur(cv);
}
} else if ( event->u.mouse.clicks<=1 && !(event->u.mouse.state&ksm_shift)) {
if ( fs->p->nextcp || fs->p->prevcp )
if ( fs->p->nextcp || fs->p->prevcp ) {
CPStartInfo(cv,event);
else if ( fs->p->sp!=NULL ) {
/* Needs update to draw control points selected */
needsupdate = true;
} else if ( fs->p->sp!=NULL ) {
if ( !fs->p->sp->selected ) needsupdate = true;
fs->p->sp->selected = true;
} else if ( fs->p->spiro!=NULL ) {
@ -632,9 +635,10 @@ return;
fs->p->ap->selected = true;
}
} else if ( event->u.mouse.clicks<=1 ) {
if ( fs->p->nextcp || fs->p->prevcp )
/* Nothing to do */;
else if ( fs->p->sp!=NULL ) {
if ( fs->p->nextcp || fs->p->prevcp ) {
/* Needs update to draw control points selected */
needsupdate = true;
} else if ( fs->p->sp!=NULL ) {
needsupdate = true;
fs->p->sp->selected = !fs->p->sp->selected;
} else if ( fs->p->spiro!=NULL ) {
@ -978,7 +982,8 @@ return(false);
if ( cv->b.sc->inspiro && hasspiro())
SplinePointListSpiroTransform(cv->b.layerheads[cv->b.drawmode]->splines,transform,false);
else
SplinePointListTransform(cv->b.layerheads[cv->b.drawmode]->splines,transform,false);
SplinePointListTransform(cv->b.layerheads[cv->b.drawmode]->splines,transform,
interpCPsOnMotion?tpt_OnlySelectedInterpCPs:tpt_OnlySelected);
for ( refs = cv->b.layerheads[cv->b.drawmode]->refs; refs!=NULL; refs=refs->next ) if ( refs->selected ) {
refs->transform[4] += transform[4];
@ -986,7 +991,7 @@ return(false);
refs->bb.minx += transform[4]; refs->bb.maxx += transform[4];
refs->bb.miny += transform[5]; refs->bb.maxy += transform[5];
for ( j=0; j<refs->layer_cnt; ++j )
SplinePointListTransform(refs->layers[j].splines,transform,true);
SplinePointListTransform(refs->layers[j].splines,transform,tpt_AllPoints);
outlinechanged = true;
}
if ( CVLayer( (CharViewBase *) cv) > ly_back ) {
@ -1438,7 +1443,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = 8+4;
gcd[k].gd.pos.x = 10; gcd[k].gd.pos.y = 8+4;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k++].creator = GLabelCreate;
@ -1451,7 +1456,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 80; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y;
gcd[k].gd.pos.x = 80; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k++].creator = GLabelCreate;
@ -1464,7 +1469,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+23;
gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+23;
gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on;
gcd[k].gd.cid = CID_Exact;
gcd[k++].creator = GRadioCreate;
@ -1473,7 +1478,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+13;
gcd[k].gd.pos.x = 5; gcd[k].gd.pos.y = gcd[k-1].gd.pos.y+13;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k].gd.cid = CID_Fuzzy;
gcd[k++].creator = GRadioCreate;
@ -1491,7 +1496,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 15; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y+17+4;
gcd[k].gd.pos.x = 15; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y+17+4;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k++].creator = GLabelCreate;
@ -1509,7 +1514,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 15; gcd[k].gd.pos.y = gcd[k-3].gd.pos.y+17+4;
gcd[k].gd.pos.x = 15; gcd[k].gd.pos.y = gcd[k-3].gd.pos.y+17+4;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k++].creator = GLabelCreate;
@ -1523,7 +1528,7 @@ void CVSelectPointAt(CharView *cv) {
label[k].text_is_1byte = true;
label[k].text_in_resource = true;
gcd[k].gd.label = &label[k];
gcd[k].gd.pos.x = 100; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y;
gcd[k].gd.pos.x = 100; gcd[k].gd.pos.y = gcd[k-2].gd.pos.y;
gcd[k].gd.flags = gg_enabled|gg_visible;
gcd[k++].creator = GLabelCreate;

Some files were not shown because too many files have changed in this diff Show More