summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/en/drv/gl.html7
-rw-r--r--html/en/drv/irgb.html2
-rw-r--r--include/cd_private.h2
-rw-r--r--mak.vc9/cd.sln3
-rw-r--r--mak.vc9/cd_freetype.vcproj900
-rw-r--r--src/cd.def13
-rw-r--r--src/cd_util.c95
-rw-r--r--src/cdgdk.def45
-rw-r--r--src/cdgl.mak14
-rw-r--r--src/drv/cdgl.c192
-rw-r--r--src/ftgl/FTContour.cpp3
-rw-r--r--src/sim/cd_truetype.c77
-rw-r--r--test/simple/gdiplustest.cpp116
-rw-r--r--test/simple/simple.c41
-rw-r--r--test/simple/simple.led2
-rw-r--r--test/simple/simple_led.c43
16 files changed, 1228 insertions, 327 deletions
diff --git a/html/en/drv/gl.html b/html/en/drv/gl.html
index e7c07d5..a7e9883 100644
--- a/html/en/drv/gl.html
+++ b/html/en/drv/gl.html
@@ -48,7 +48,7 @@ must be set with the new size or cdCanvasGetSize will return an incorrect value.
<p>To use this driver, the application must be linked with the &quot;<strong>cdgl</strong>&quot;,
the ftgl library
and the OpenGL library. The FTGL library is dependent also on the GLU
- library.</p>
+ library. In UNIX <strong>cdgl</strong> is also dependent on <strong>iconv</strong>.</p>
<p>In Lua, it is necessary to call function <font face="Courier"> <strong>cdluagl_open() </strong> </font>after a call
to function <strong><font face="Courier">cdlua_open()</font></strong>, apart from linkediting with the &quot;<strong><font face="Courier">cdluagl</font></strong>&quot;
library. This is not necessary if you do require&quot;cdluagl&quot;.&nbsp;</p>
@@ -111,7 +111,10 @@ must be set with the new size or cdCanvasGetSize will return an incorrect value.
&quot;Courier New&quot;, &quot;Helvetica&quot; is mapped to &quot;Arial&quot;, and &quot;Times&quot; is mapped to
&quot;Times New Roman&quot;. In UNIX, &quot;Courier&quot; is mapped to
&quot;freemono&quot;, &quot;Helvetica&quot; is mapped to &quot;freesans&quot;, and &quot;Times&quot; is mapped to
- &quot;freeserif&quot;. Underline and Strikeout are NOT supported.</li>
+ &quot;freeserif&quot;. Underline and Strikeout are NOT supported. If not
+ found then the font file is searched used the same logic of the <a href="sim.html">Simulation</a>
+ driver, but <strong>ADDFONTMAP</strong> is not supported. If still is not
+ found then the typeface is used as file name for the font. </li>
</ul>
<h4>Colors </h4>
<ul>
diff --git a/html/en/drv/irgb.html b/html/en/drv/irgb.html
index 5f6718e..f44a9d4 100644
--- a/html/en/drv/irgb.html
+++ b/html/en/drv/irgb.html
@@ -62,7 +62,7 @@ cd.ImageRGBBitmap(canvas: cdCanvas) -&gt; (bitmap: cdBitmap) [in Lua]</font></h4
<h3>Behavior of Functions</h3>
- <p>All primitives are from the Simulation driver, see the <a href="sim.html">Simulation</a> driver's documentation for
+ <p>All primitives are from the Simulation driver, see the <a href="sim.html">Simulation</a> driver documentation for
further information.</p>
<h4>Control</h4>
diff --git a/include/cd_private.h b/include/cd_private.h
index e6adef5..05395b2 100644
--- a/include/cd_private.h
+++ b/include/cd_private.h
@@ -273,10 +273,12 @@ int cdfCheckBoxSize(double *xmin, double *xmax, double *ymin, double *ymax);
void cdNormalizeLimits(int w, int h, int *xmin, int *xmax, int *ymin, int *ymax);
int cdGetFileName(const char* strdata, char* filename);
int cdStrEqualNoCase(const char* str1, const char* str2);
+int cdStrEqualNoCasePartial(const char* str1, const char* str2);
int cdStrLineCount(const char* str);
char* cdStrDup(const char* str);
char* cdStrDupN(const char* str, int len);
void cdSetPaperSize(int size, double *w_pt, double *h_pt);
+int cdGetFontFileName(const char* font, char* filename);
void cdCanvasPoly(cdCanvas* canvas, int mode, cdPoint* points, int n);
void cdCanvasGetArcBox(int xc, int yc, int w, int h, double a1, double a2, int *xmin, int *xmax, int *ymin, int *ymax);
diff --git a/mak.vc9/cd.sln b/mak.vc9/cd.sln
index 7959a46..54e2f2b 100644
--- a/mak.vc9/cd.sln
+++ b/mak.vc9/cd.sln
@@ -137,6 +137,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdluapdf52", "cdluapdf52.vcproj", "{B4823266-DF8C-ABC1-DF8C-12688C234EAC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdgl", "cdgl.vcproj", "{8441F69D-7135-AB59-1F94-4522123C8467}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1D758EEA-59C3-46E4-BEF5-16DCCA8C0B21} = {1D758EEA-59C3-46E4-BEF5-16DCCA8C0B21}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftgl", "cd_ftgl.vcproj", "{1D758EEA-59C3-46E4-BEF5-16DCCA8C0B21}"
EndProject
diff --git a/mak.vc9/cd_freetype.vcproj b/mak.vc9/cd_freetype.vcproj
index 333d103..810fb75 100644
--- a/mak.vc9/cd_freetype.vcproj
+++ b/mak.vc9/cd_freetype.vcproj
@@ -276,6 +276,906 @@
>
</File>
</Filter>
+ <Filter
+ Name="inc"
+ >
+ <File
+ RelativePath="..\src\freetype2\autofit\afangles.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afcjk.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afdummy.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\aferrors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afglobal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afhints.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afindic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\aflatin.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\aflatin2.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afloader.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afmodule.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\afmparse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\aftypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\autofit\afwarp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\autohint.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\base\basepic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\bdf\bdf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\bdf\bdfdrivr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\bdf\bdferror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffcmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffdrivr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cfferrs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffgload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffparse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cffpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cfftoken.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cff\cfftypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\ciderrs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidgload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidparse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidriver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cid\cidtoken.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\winfonts\fnterrs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\freetype.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\ft2build.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftadvanc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\base\ftbase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftbbox.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftbdf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftbitmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftcache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftcalc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftccache.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftccback.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcerror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcglyph.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftchapters.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftcid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcimage.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcmanag.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcmru.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\config\ftconfig.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\cache\ftcsbits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftdebug.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftdriver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\fterrdef.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\fterrors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftgasp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftgloadr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftglyph.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\smooth\ftgrays.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftgxval.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftgzip.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\config\ftheader.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftimage.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftincrem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftlcdfil.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftlist.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftlzw.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftmac.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftmemory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\raster\ftmisc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftmm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftmodapi.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftmoderr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\config\ftmodule.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\config\ftoption.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftotval.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftoutln.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftpfr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\raster\ftraster.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\raster\ftrend1.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftrender.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftrfork.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftserv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftsizes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\smooth\ftsmerrs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\smooth\ftsmooth.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftsnames.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\smooth\ftspic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\config\ftstdlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftstream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftstroke.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftsynth.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftsystem.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\fttrace.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\fttrigon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\fttypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\ftvalid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftwinfnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ftxf86.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\lzw\ftzopen.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvalid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvcommn.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxverror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvfeat.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvmod.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvmort.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gxvalid\gxvmorx.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\infblock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\infcodes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\inffixed.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\inftrees.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\infutil.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\internal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\otvalid\otvalid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\otvalid\otvcommn.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\otvalid\otverror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\otvalid\otvgpos.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\otvalid\otvmod.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pcf\pcf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pcf\pcfdrivr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pcf\pcferror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pcf\pcfread.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\pcftypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pcf\pcfutil.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrcmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrdrivr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrerror.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrgload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrsbit.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pfr\pfrtypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\psaux.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\psauxerr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\psauxmod.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\psconv.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshalgo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshglob.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\pshints.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshmod.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshnterr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\pshinter\pshrec.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psnames\psmodule.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psnames\psnamerr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\psobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psnames\pspic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psnames\pstables.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\raster\rasterrs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\raster\rastpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\sfdriver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\sferrors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\sfnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\sfntpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\sfobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svbdf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svcid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svgldict.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svgxval.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svkern.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svmm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svotval.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svpfr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svpostnm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svpscmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svpsinfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svsfnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svttcmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svtteng.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svttglyf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svwinfnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\services\svxf86nm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1afm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\t1cmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\psaux\t1decode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1driver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1errors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1gload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1load.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1objs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1parse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\t1tables.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type1\t1tokens.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\t1types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type42\t42drivr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type42\t42error.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type42\t42objs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type42\t42parse.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\type42\t42types.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttbdf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttcmap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttcmapc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttdriver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\tterrors.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttgload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttgxvar.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttinterp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttkern.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttmtx.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ttnameid.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttobjs.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttpic.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\truetype\ttpload.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttpost.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttsbit.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\sfnt\ttsbit0.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\tttables.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\tttags.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\internal\tttypes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\freetype\ttunpat.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\winfonts\winfnt.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\zconf.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\zlib.h"
+ >
+ </File>
+ <File
+ RelativePath="..\src\freetype2\gzip\zutil.h"
+ >
+ </File>
+ </Filter>
</Filter>
<File
RelativePath="..\src\cd_freetype.def"
diff --git a/src/cd.def b/src/cd.def
index 2b692ae..e3802b2 100644
--- a/src/cd.def
+++ b/src/cd.def
@@ -192,11 +192,6 @@ EXPORTS
wdVectorText
wdMultiLineVectorText
wdGetVectorTextBounds
-
- cdwCreateCanvas
- cdwInitTable
- cdwKillCanvas
- cdwRestoreDC
cdLineStyleDashes
cdRegionBox
@@ -226,6 +221,8 @@ EXPORTS
cdCanvasGetArcBox
cdCanvasGetArcStartEnd
cdfCanvasGetArcStartEnd
+ cdStrEqualNoCasePartial
+ cdGetFontFileName
wdCanvasLineWidth
wdCanvasMarkSize
@@ -409,4 +406,8 @@ EXPORTS
cdfSimSector
cdfSimChord
cdSimChord
- \ No newline at end of file
+
+ cdwCreateCanvas
+ cdwInitTable
+ cdwKillCanvas
+ cdwRestoreDC
diff --git a/src/cd_util.c b/src/cd_util.c
index b278dfc..20e9a46 100644
--- a/src/cd_util.c
+++ b/src/cd_util.c
@@ -308,6 +308,8 @@ void cdRotatePointY(cdCanvas* canvas, int x, int y, int cx, int cy, int *ry, dou
*ry = *ry + cy;
}
+/* Copied from IUP3 */
+
int cdStrEqualNoCase(const char* str1, const char* str2)
{
int i = 0;
@@ -321,6 +323,20 @@ int cdStrEqualNoCase(const char* str1, const char* str2)
return 0;
}
+int cdStrEqualNoCasePartial(const char* str1, const char* str2)
+{
+ int i = 0;
+ if (str1 == str2) return 1;
+ if (!str1 || !str2 || tolower(*str1) != tolower(*str2)) return 0;
+
+ while (str1[i] && str2[i] && tolower(str1[i])==tolower(str2[i]))
+ i++;
+ if (str1[i] == str2[i]) return 1;
+ if (str2[i] == 0) return 1;
+
+ return 0;
+}
+
/* Copied from IUP3, simply ignore line breaks other than '\n' for CD */
int cdStrLineCount(const char* str)
@@ -398,3 +414,82 @@ void cdSetPaperSize(int size, double *w_pt, double *h_pt)
*h_pt = (double)paper[size].h_pt;
}
+#ifdef WIN32
+#include <windows.h>
+static int sReadStringKey(HKEY base_key, char* key_name, char* value_name, char* value)
+{
+ HKEY key;
+ DWORD max_size = 512;
+
+ if (RegOpenKeyEx(base_key, key_name, 0, KEY_READ, &key) != ERROR_SUCCESS)
+ return 0;
+
+ if (RegQueryValueEx(key, value_name, NULL, NULL, (LPBYTE)value, &max_size) != ERROR_SUCCESS)
+ {
+ RegCloseKey(key);
+ return 0;
+ }
+
+ RegCloseKey(key);
+ return 1;
+}
+
+static char* sGetFontDir(void)
+{
+ static char font_dir[512];
+ if (!sReadStringKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Fonts", font_dir))
+ return "";
+ else
+ {
+ int i, size = (int)strlen(font_dir);
+ for(i = 0; i < size; i++)
+ {
+ if (font_dir[i] == '\\')
+ font_dir[i] = '/';
+ }
+ return font_dir;
+ }
+}
+#endif
+
+int cdGetFontFileName(const char* font, char* filename)
+{
+ FILE *file;
+
+ /* current directory */
+ sprintf(filename, "%s.ttf", font);
+ file = fopen(filename, "r");
+
+ if (file)
+ fclose(file);
+ else
+ {
+ /* CD environment */
+ char* env = getenv("CDDIR");
+ if (env)
+ {
+ sprintf(filename, "%s/%s.ttf", env, font);
+ file = fopen(filename, "r");
+ }
+
+ if (file)
+ fclose(file);
+ else
+ {
+#ifdef WIN32
+ /* Windows Font folder */
+ sprintf(filename, "%s/%s.ttf", sGetFontDir(), font);
+ file = fopen(filename, "r");
+
+ if (file)
+ fclose(file);
+ else
+ return 0;
+#else
+ return 0;
+#endif
+ }
+ }
+
+ return 1;
+}
diff --git a/src/cdgdk.def b/src/cdgdk.def
index c240a3d..dba219a 100644
--- a/src/cdgdk.def
+++ b/src/cdgdk.def
@@ -17,15 +17,6 @@ EXPORTS
cdContextDebug
cdContextSVG
- cdContextCairoImage
- cdContextCairoImageRGB
- cdContextCairoPS
- cdContextCairoNativeWindow
- cdContextCairoDBuffer
- cdContextCairoSVG
- cdContextCairoPDF
- cdInitContextPlus
-
cdRedImage
cdGreenImage
cdBlueImage
@@ -201,7 +192,7 @@ EXPORTS
wdVectorText
wdMultiLineVectorText
wdGetVectorTextBounds
-
+
cdLineStyleDashes
cdRegionBox
wdRegionBox
@@ -223,6 +214,15 @@ EXPORTS
cdGetFontSizePixels
cdGetFontSizePoints
cdStrEqualNoCase
+ cdSetPaperSize
+ cdCanvasGetArcPath
+ cdfCanvasGetArcPath
+ cdCanvasGetArcPathF
+ cdCanvasGetArcBox
+ cdCanvasGetArcStartEnd
+ cdfCanvasGetArcStartEnd
+ cdStrEqualNoCasePartial
+ cdGetFontFileName
wdCanvasLineWidth
wdCanvasMarkSize
@@ -364,6 +364,7 @@ EXPORTS
cdCanvasVectorTextDirection
cdCanvasVectorTextSize
cdCanvasVertex
+ cdCanvasPathSet
cdfCanvasGetClipArea
cdfCanvasArc
@@ -390,6 +391,28 @@ EXPORTS
cdCanvasSetBackground
cdCanvasTransformPoint
cdfCanvasTransformPoint
-
+ cdRound
+ cdStrDup
+
cdInitContextPlusList
cdGetContextPlus
+
+ cdfSimPolyPath
+ cdSimArc
+ cdSimPolyPath
+ cdfRotatePoint
+ cdSimSector
+ cdfSimArc
+ cdfSimSector
+ cdfSimChord
+ cdSimChord
+
+ cdContextCairoImage
+ cdContextCairoImageRGB
+ cdContextCairoPS
+ cdContextCairoNativeWindow
+ cdContextCairoDBuffer
+ cdContextCairoSVG
+ cdContextCairoPDF
+ cdInitContextPlus
+
diff --git a/src/cdgl.mak b/src/cdgl.mak
index 21a9b88..7b5f8e6 100644
--- a/src/cdgl.mak
+++ b/src/cdgl.mak
@@ -8,13 +8,25 @@ SRC = drv/cdgl.c
INCLUDES = . sim ftgl freetype2
LIBS = ftgl
ifeq ($(findstring Win, $(TEC_SYSNAME)), )
- LIBS += iconv
+# LIBS += iconv
endif
USE_OPENGL = YES
USE_CD = YES
CD = ..
+ifneq ($(findstring AIX, $(TEC_UNAME)), )
+ NO_FONTCONFIG = Yes
+endif
+
+ifneq ($(findstring IRIX, $(TEC_UNAME)), )
+ NO_FONTCONFIG = Yes
+endif
+
+ifneq ($(findstring SunOS, $(TEC_UNAME)), )
+ NO_FONTCONFIG = Yes
+endif
+
ifneq ($(findstring MacOS, $(TEC_UNAME)), )
ifeq ($(TEC_SYSMINOR), 5)
#Darwin9 Only - OpenGL bug fix for Fink, when the message bellow appears
diff --git a/src/drv/cdgl.c b/src/drv/cdgl.c
index 94b1367..4357e5a 100644
--- a/src/drv/cdgl.c
+++ b/src/drv/cdgl.c
@@ -57,7 +57,6 @@ struct _cdCtxCanvas
cdCanvas* canvas;
FTGLfont *font;
- char fontfilename[10240];
char* glLastConvertUTF8;
@@ -71,7 +70,7 @@ struct _cdCtxCanvas
/******************************************************/
-static char* cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, unsigned int len)
+static char* cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, int len)
{
if (ctxcanvas->glLastConvertUTF8)
free(ctxcanvas->glLastConvertUTF8);
@@ -102,7 +101,8 @@ static char* cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, unsig
/* Based on http://www.lemoda.net/c/iconv-example/iconv-example.html
Last access: June 15th, 2010. */
iconv_t cd;
- unsigned int utf8len = len*2;
+ size_t ulen = (size_t)len;
+ size_t utf8len = ulen*2;
char* utf8 = calloc(utf8len, 1);
cd = iconv_open("UTF-8", "ISO-8859-1");
@@ -110,7 +110,7 @@ static char* cdglStrConvertToUTF8(cdCtxCanvas *ctxcanvas, const char* str, unsig
return (char*)str;
ctxcanvas->glLastConvertUTF8 = utf8;
- iconv(cd, (char**)&str, &len, &utf8, &utf8len);
+ iconv(cd, (char**)&str, &ulen, &utf8, &utf8len);
iconv_close(cd);
}
@@ -347,6 +347,7 @@ static LONG cdglWGetNextNameValue(HKEY key, LPCTSTR subkey, LPTSTR szName, LPTST
RegCloseKey(hkey);
hkey = NULL;
+ dwIndex = 0;
return ERROR_SUCCESS;
}
@@ -382,43 +383,78 @@ static LONG cdglWGetNextNameValue(HKEY key, LPCTSTR subkey, LPTSTR szName, LPTST
return retval;
}
-static int cdglWGetFontFileName(LPCTSTR lpszFontName, int bold, int italic, char* fileName)
+static int sReadStringKey(HKEY base_key, char* key_name, char* value_name, char* value)
+{
+ HKEY key;
+ DWORD max_size = 512;
+
+ if (RegOpenKeyEx(base_key, key_name, 0, KEY_READ, &key) != ERROR_SUCCESS)
+ return 0;
+
+ if (RegQueryValueEx(key, value_name, NULL, NULL, (LPBYTE)value, &max_size) != ERROR_SUCCESS)
+ {
+ RegCloseKey(key);
+ return 0;
+ }
+
+ RegCloseKey(key);
+ return 1;
+}
+
+static char* sGetFontDir(void)
+{
+ static char font_dir[1024];
+ if (!sReadStringKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Fonts", font_dir))
+ return "";
+ else
+ return font_dir;
+}
+
+static int sGetFontFileName(const char *font_name, int bold, int italic, char* fileName)
{
TCHAR szName[2 * MAX_PATH];
TCHAR szData[2 * MAX_PATH];
- TCHAR displayName[2 * MAX_PATH];
LPCTSTR strFont = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
char localFontName[256];
int bResult = 0;
- sprintf(localFontName, "%s", lpszFontName);
+ if (cdStrEqualNoCase(font_name, "Courier") || cdStrEqualNoCase(font_name, "Monospace"))
+ font_name = "Courier New";
+ else if (cdStrEqualNoCase(font_name, "Times") || cdStrEqualNoCase(font_name, "Serif"))
+ font_name = "Times New Roman";
+ else if (cdStrEqualNoCase(font_name, "Helvetica") || cdStrEqualNoCase(font_name, "Sans"))
+ font_name = "Arial";
+
+ strcpy(localFontName, font_name);
- if( bold )
+ if (bold)
strcat(localFontName, " Bold");
- if( italic )
+ if (italic)
strcat(localFontName, " Italic");
while (cdglWGetNextNameValue(HKEY_LOCAL_MACHINE, strFont, szName, szData) == ERROR_SUCCESS)
{
- if (_strnicmp(localFontName, szName, strlen(localFontName)) == 0)
+ if (cdStrEqualNoCasePartial(szName, localFontName))
{
- sprintf(displayName, "%s", szName);
- sprintf(fileName, "%s", szData);
+ //"%s/%s.ttf"
+ sprintf(fileName, "%s\\%s", sGetFontDir(), szData);
bResult = 1;
break;
}
- strFont = "";
+ strFont = NULL;
}
+
/* close the registry key */
cdglWGetNextNameValue(HKEY_LOCAL_MACHINE, NULL, NULL, NULL);
return bResult;
}
#else
+#ifndef NO_FONTCONFIG
#include <fontconfig/fontconfig.h>
-static int cdglXGetFontFileName(const char *font_name, int bold, int italic, char* fileName)
+static int sGetFontFileName(const char *font_name, int bold, int italic, char* fileName)
{
char styles[4][20];
int style_size;
@@ -427,30 +463,37 @@ static int cdglXGetFontFileName(const char *font_name, int bold, int italic, cha
FcPattern *pat;
int bResult = 0;
+ if (cdStrEqualNoCase(font_name, "Courier") || cdStrEqualNoCase(font_name, "Courier New") || cdStrEqualNoCase(font_name, "Monospace"))
+ font_name = "freemono";
+ else if (cdStrEqualNoCase(font_name, "Times") || cdStrEqualNoCase(font_name, "Times New Roman")|| cdStrEqualNoCase(font_name, "Serif"))
+ font_name = "freeserif";
+ else if (cdStrEqualNoCase(font_name, "Helvetica") || cdStrEqualNoCase(font_name, "Arial") || cdStrEqualNoCase(font_name, "Sans"))
+ font_name = "freesans";
+
if( bold && italic )
{
- sprintf(styles[0], "%s", "BoldItalic");
- sprintf(styles[1], "%s", "Bold Italic");
- sprintf(styles[2], "%s", "Bold Oblique");
- sprintf(styles[3], "%s", "BoldOblique");
+ strcpy(styles[0], "BoldItalic");
+ strcpy(styles[1], "Bold Italic");
+ strcpy(styles[2], "Bold Oblique");
+ strcpy(styles[3], "BoldOblique");
style_size = 4;
}
else if( bold )
{
- sprintf(styles[0], "%s", "Bold");
+ strcpy(styles[0], "Bold");
style_size = 1;
}
else if( italic )
{
- sprintf(styles[0], "%s", "Italic");
- sprintf(styles[1], "%s", "Oblique");
+ strcpy(styles[0], "Italic");
+ strcpy(styles[1], "Oblique");
style_size = 2;
}
else
{
- sprintf(styles[0], "%s", "Regular");
- sprintf(styles[1], "%s", "Normal");
- sprintf(styles[2], "%s", "Medium");
+ strcpy(styles[0], "Regular");
+ strcpy(styles[1], "Normal");
+ strcpy(styles[2], "Medium");
style_size = 3;
}
@@ -474,22 +517,21 @@ static int cdglXGetFontFileName(const char *font_name, int bold, int italic, cha
FcPatternGetString(fs->fonts[j], FC_STYLE, 0, &style );
FcPatternGetString(fs->fonts[j], FC_FAMILY, 0, &family );
- if (strncasecmp(font_name, (char*)family, strlen(font_name)) == 0)
+ if (cdStrEqualNoCasePartial((char*)family, font_name))
{
/* check if the font is of the correct type. */
for(s = 0; s < style_size; s++ )
{
- if (strcasecmp(styles[s], (char*)style ) == 0)
+ if (cdStrEqualNoCase(styles[s], (char*)style))
{
- sprintf(fileName, "%s", (char*)file);
+ strcpy(fileName, (char*)file);
bResult = 1;
FcFontSetDestroy (fs);
-
return bResult;
}
/* set value to use if no more correct font of same family is found. */
- sprintf(fileName, "%s", (char*)file);
+ strcpy(fileName, (char*)file);
bResult = 1;
}
}
@@ -499,12 +541,22 @@ static int cdglXGetFontFileName(const char *font_name, int bold, int italic, cha
return bResult;
}
+#else
+static int sGetFontFileName(const char *font_name, int bold, int italic, char* fileName)
+{
+ (void)font_name;
+ (void)bold;
+ (void)italic;
+ (void)fileName;
+ return 0;
+}
+#endif
#endif
static int cdfont(cdCtxCanvas *ctxcanvas, const char *typeface, int style, int size)
{
int is_italic = 0, is_bold = 0; /* default is CD_PLAIN */
- char strFontFileName[256];
+ char strFontFileName[10240];
if (style & CD_BOLD)
is_bold = 1;
@@ -512,34 +564,44 @@ static int cdfont(cdCtxCanvas *ctxcanvas, const char *typeface, int style, int s
if (style & CD_ITALIC)
is_italic = 1;
-#ifdef WIN32
- if (cdStrEqualNoCase(typeface, "Courier") || cdStrEqualNoCase(typeface, "Monospace"))
- typeface = "Courier New";
- else if (cdStrEqualNoCase(typeface, "Times") || cdStrEqualNoCase(typeface, "Serif"))
- typeface = "Times New Roman";
- else if (cdStrEqualNoCase(typeface, "Helvetica") || cdStrEqualNoCase(typeface, "Sans"))
- typeface = "Arial";
-
- if(!cdglWGetFontFileName(typeface, is_bold, is_italic, strFontFileName))
- return 0;
-
- sprintf(ctxcanvas->fontfilename, "%s\\fonts\\%s", getenv("windir"), strFontFileName);
-#else
- if (cdStrEqualNoCase(typeface, "Courier") || cdStrEqualNoCase(typeface, "Courier New") || cdStrEqualNoCase(typeface, "Monospace"))
- typeface = "freemono";
- else if (cdStrEqualNoCase(typeface, "Times") || cdStrEqualNoCase(typeface, "Times New Roman")|| cdStrEqualNoCase(typeface, "Serif"))
- typeface = "freeserif";
- else if (cdStrEqualNoCase(typeface, "Helvetica") || cdStrEqualNoCase(typeface, "Arial") || cdStrEqualNoCase(typeface, "Sans"))
- typeface = "freesans";
-
- if(!cdglXGetFontFileName(typeface, is_bold, is_italic, strFontFileName))
- return 0;
-
- sprintf(ctxcanvas->fontfilename, "%s", strFontFileName);
-#endif
+ /* search for the font in the system */
+ if (!sGetFontFileName(typeface, is_bold, is_italic, strFontFileName))
+ {
+ /* try typeface as a file title, compose to get a filename */
+ if (!cdGetFontFileName(typeface, strFontFileName))
+ {
+ /* try the same configuration of the simulation driver */
+ static char * cd_ttf_font_style[4] = {
+ "",
+ "bd",
+ "i",
+ "bi"};
+ char* face = NULL;
+
+ /* check for the pre-defined names */
+ if (cdStrEqualNoCase(typeface, "System"))
+ face = "cour";
+ else if (cdStrEqualNoCase(typeface, "Courier"))
+ face = "cour";
+ else if (cdStrEqualNoCase(typeface, "Times"))
+ face = "times";
+ else if (cdStrEqualNoCase(typeface, "Helvetica"))
+ face = "arial";
+
+ if (face)
+ {
+ /* create a shortname for the file title */
+ char shorname[100];
+ sprintf(shorname, "%s%s", face, cd_ttf_font_style[style&3]);
+ if (!cdGetFontFileName(shorname, strFontFileName))
+ strcpy(strFontFileName, typeface); /* try the typeface as file name */
+ }
+ else
+ strcpy(strFontFileName, typeface); /* try the typeface as file name */
+ }
+ }
- ctxcanvas->font = ftglCreateBufferFont(ctxcanvas->fontfilename);
-
+ ctxcanvas->font = ftglCreateBufferFont(strFontFileName);
if (!ctxcanvas->font)
return 0;
@@ -650,9 +712,9 @@ static void cdbox(cdCtxCanvas *ctxcanvas, int xmin, int xmax, int ymin, int ymax
static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *s, int len)
{
- int dir = -1, stipple = 0;
+ int stipple = 0;
float bounds[6];
- int w, h, desc;
+ int w, h, descent, baseline;
double x_origin = x;
double y_origin = y;
@@ -662,9 +724,10 @@ static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *s, i
s = cdglStrConvertToUTF8(ctxcanvas, s, len);
ftglGetFontBBox(ctxcanvas->font, s, len, bounds);
- desc = (int)ftglGetFontDescender(ctxcanvas->font);
+ descent = (int)ftglGetFontDescender(ctxcanvas->font);
w = (int)ceil(bounds[3] - bounds[0]);
h = (int)ceil(bounds[4] - bounds[1]);
+ baseline = (int)ftglGetFontLineHeight(ctxcanvas->font) - (int)ftglGetFontAscender(ctxcanvas->font);
switch (ctxcanvas->canvas->text_alignment)
{
@@ -688,9 +751,6 @@ static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *s, i
break;
}
- if (ctxcanvas->canvas->invert_yaxis)
- dir = 1;
-
switch (ctxcanvas->canvas->text_alignment)
{
case CD_BASE_LEFT:
@@ -701,17 +761,17 @@ static void cdftext(cdCtxCanvas *ctxcanvas, double x, double y, const char *s, i
case CD_SOUTH_EAST:
case CD_SOUTH_WEST:
case CD_SOUTH:
- y = y + dir * desc;
+ y = y - descent;
break;
case CD_NORTH_EAST:
case CD_NORTH:
case CD_NORTH_WEST:
- y = y + dir * (h + desc);
+ y = y - h/2 - baseline;
break;
case CD_CENTER:
case CD_EAST:
case CD_WEST:
- y = y + dir * (h / 2);
+ y = y - baseline;
break;
}
diff --git a/src/ftgl/FTContour.cpp b/src/ftgl/FTContour.cpp
index cef1f3b..6b92812 100644
--- a/src/ftgl/FTContour.cpp
+++ b/src/ftgl/FTContour.cpp
@@ -33,6 +33,9 @@
static const unsigned int BEZIER_STEPS = 5;
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
void FTContour::AddPoint(FTPoint point)
{
diff --git a/src/sim/cd_truetype.c b/src/sim/cd_truetype.c
index e7dad41..9fda0e3 100644
--- a/src/sim/cd_truetype.c
+++ b/src/sim/cd_truetype.c
@@ -9,91 +9,22 @@
#include <memory.h>
#include <stdio.h>
+#include "cd.h"
+#include "cd_private.h"
#include "cd_truetype.h"
/*******************************************
Inicializa o Rasterizador
********************************************/
-#ifdef WIN32
-#include <windows.h>
-static int ReadStringKey(HKEY base_key, char* key_name, char* value_name, char* value)
-{
- HKEY key;
- DWORD max_size = 512;
-
- if (RegOpenKeyEx(base_key, key_name, 0, KEY_READ, &key) != ERROR_SUCCESS)
- return 0;
-
- if (RegQueryValueEx(key, value_name, NULL, NULL, (LPBYTE)value, &max_size) != ERROR_SUCCESS)
- {
- RegCloseKey(key);
- return 0;
- }
-
- RegCloseKey(key);
- return 1;
-}
-
-char* GetFontDir(void)
-{
- static char font_dir[512];
- if (!ReadStringKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Fonts", font_dir))
- return "";
- else
- {
- int i, size = (int)strlen(font_dir);
- for(i = 0; i < size; i++)
- {
- if (font_dir[i] == '\\')
- font_dir[i] = '/';
- }
- return font_dir;
- }
-}
-#endif
-
int cdTT_load(cdTT_Text * tt_text, const char *font, int size, double xres, double yres)
{
char filename[10240];
- FILE *file; /* usado apenas para procurar pelo arquivo */
FT_Error error;
FT_Face face;
- /* abre arq. no dir. corrente */
- sprintf(filename, "%s.ttf", font);
- file = fopen(filename, "r");
-
- if (file)
- fclose(file);
- else
- {
- /* se nao conseguiu, abre arq. no dir. do cd, */
- char* env = getenv("CDDIR");
- if (env)
- {
- sprintf(filename, "%s/%s.ttf", env, font);
- file = fopen(filename, "r");
- }
-
- if (file)
- fclose(file);
- else
- {
-#ifdef WIN32
- /* no caso do Windows procura no seu diretorio de fontes. */
- sprintf(filename, "%s/%s.ttf", GetFontDir(), font);
- file = fopen(filename, "r");
-
- if (file)
- fclose(file);
- else
- return 0;
-#else
- return 0;
-#endif
- }
- }
+ if (!cdGetFontFileName(font, filename))
+ return 0;
error = FT_New_Face(tt_text->library, filename, 0, &face );
if (error)
diff --git a/test/simple/gdiplustest.cpp b/test/simple/gdiplustest.cpp
deleted file mode 100644
index af7b643..0000000
--- a/test/simple/gdiplustest.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#include <windows.h>
-#include <gdiplus.h>
-using namespace Gdiplus;
-
-/* Visual C++ 7.1 + SP1
- GDI+ 1.0 File Version 5.1.3102.2180
-*/
-
-void DrawLineMarks(Graphics* graphics, Pen* greenPen, int x, int y, int w, int h)
-{
- graphics->DrawLine(greenPen, x+w-1, y-5, x+w-1, y+5); // end markers
- graphics->DrawLine(greenPen, x-5, y+h-1, x+5, y+h-1);
-}
-
-void SimpleImageTest(HWND hWnd)
-{
- int x, y;
- Graphics* graphics = new Graphics(hWnd);
- graphics->Clear(Color(255, 255, 255)); // white background
-
- Bitmap image(16, 16, PixelFormat24bppRGB);
- image.SetResolution(graphics->GetDpiX(), graphics->GetDpiX());
-
- /* black pixel border */
- for (y = 0; y < 16; y++)
- image.SetPixel(0, y, Color(0, 0, 0));
- for (y = 0; y < 16; y++)
- image.SetPixel(15, y, Color(0, 0, 0));
- for (x = 1; x < 15; x++)
- image.SetPixel(x, 0, Color(0, 0, 0));
- for (x = 1; x < 15; x++)
- image.SetPixel(x, 15, Color(0, 0, 0));
-
- /* light yellow contents */
- for (y = 1; y < 15; y++)
- for (x = 1; x < 15; x++)
- image.SetPixel(x, y, Color(192, 192, 0));
-
- Pen redPen(Color(255, 0, 0), 1);
- redPen.SetDashStyle(DashStyleDash);
- Pen greenPen(Color(0, 255, 0), 1);
- greenPen.SetDashStyle(DashStyleDash);
-
- // I add {} to avoid reusing some Rect in the next test
-
- graphics->SetPixelOffsetMode(PixelOffsetModeHalf); // pixel center is (.5,.5) instead of (0, 0)
-
- // NO zoom
- {
- RectF actualRect(10, 10, 16, 16);
- graphics->DrawImage(&image, 10, 10);
- graphics->DrawRectangle(&redPen, actualRect);
- DrawLineMarks(graphics, &greenPen, 10, 10, 16, 16);
- }
-
- // zoom using Bilinear Interpolation
- {
- RectF zoomRect(50, 10, 160, 160);
- graphics->SetInterpolationMode(InterpolationModeBilinear);
- graphics->DrawImage(&image, zoomRect);
- graphics->DrawRectangle(&redPen, zoomRect);
- DrawLineMarks(graphics, &greenPen, 50, 10, 160, 160);
- }
-
- // zoom using Nearest Neighborhood
- {
- RectF zoomRect2(250, 10, 160, 160);
- graphics->SetInterpolationMode(InterpolationModeNearestNeighbor);
- graphics->DrawImage(&image, zoomRect2);
- graphics->DrawRectangle(&redPen, zoomRect2);
- DrawLineMarks(graphics, &greenPen, 250, 10, 160, 160);
- }
-
-
- // Using a source image size, smaller than actual
-
-
- // NO zoom
- {
- RectF actualRect3(10, 200, 16, 16);
- graphics->DrawImage(&image, actualRect3, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
- graphics->DrawRectangle(&redPen, actualRect3);
- DrawLineMarks(graphics, &greenPen, 10, 400, 16, 16);
- }
-
- // zoom using Bilinear Interpolation
- {
- RectF zoomRect6(50, 200, 160, 160);
- graphics->SetInterpolationMode(InterpolationModeBilinear);
- graphics->DrawImage(&image, zoomRect6, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
- graphics->DrawRectangle(&redPen, zoomRect6);
- DrawLineMarks(graphics, &greenPen, 50, 400, 160, 160);
- }
-
- // zoom using Nearest Neighborhood
- {
- RectF zoomRect7(250, 200, 160, 160);
- graphics->SetInterpolationMode(InterpolationModeNearestNeighbor);
- graphics->DrawImage(&image, zoomRect7, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
- graphics->DrawRectangle(&redPen, zoomRect7);
- DrawLineMarks(graphics, &greenPen, 250, 400, 160, 160);
- }
-
- delete graphics;
-}
-
-#include <iup.h>
-
-extern "C" char* winData;
-extern "C" void SimpleDrawTest(void);
-
-void SimpleDrawTest(void)
-{
- HWND hWnd = (HWND)IupGetAttribute((Ihandle*)winData, "HWND");
- SimpleImageTest(hWnd);
-}
diff --git a/test/simple/simple.c b/test/simple/simple.c
index e9e3429..c47812e 100644
--- a/test/simple/simple.c
+++ b/test/simple/simple.c
@@ -559,6 +559,9 @@ void SimpleDraw(cdCanvas* canvas)
SimpleUpdateSize(canvas);
#endif
+ /* refresh CD canvas size, when window size has changed */
+ cdCanvasActivate(canvas);
+
if (simple_draw == DRAW_TEXTFONTS)
SimpleDrawTextFonts(canvas);
else if (simple_draw == DRAW_TEXTALIGN)
@@ -568,6 +571,10 @@ void SimpleDraw(cdCanvas* canvas)
else
SimpleDrawAll(canvas);
+ /* Adds a new page, or
+ flushes the file, or
+ flushes the screen, or
+ swap the double buffer. */
cdCanvasFlush(canvas);
#ifdef USE_OPENGL
@@ -712,7 +719,7 @@ void SimpleDrawAll(cdCanvas* canvas)
Notice that in some drivers the bounding box is not precise. */
{
int rect[8];
- cdCanvasGetTextBounds(canvas, w/2, h/2, "cdMin Draw (çãí)", rect);
+ cdCanvasGetTextBounds(canvas, w/2, h/2, "Simple Draw (pçãí)", rect);
cdCanvasForeground(canvas, CD_RED);
cdCanvasBegin(canvas, CD_CLOSED_LINES);
cdCanvasVertex(canvas, rect[0], rect[1]);
@@ -722,7 +729,7 @@ void SimpleDrawAll(cdCanvas* canvas)
cdCanvasEnd(canvas);
}
cdCanvasForeground(canvas, CD_BLUE);
- cdCanvasText(canvas, w/2, h/2, "cdMin Draw (çãí)");
+ cdCanvasText(canvas, w/2, h/2, "Simple Draw (pçãí)");
cdCanvasTextOrientation(canvas, 0);
/* Prepare World Coordinates */
@@ -965,12 +972,6 @@ void SimpleDrawAll(cdCanvas* canvas)
if (use_transform)
cdCanvasTransform(canvas, NULL);
cdCanvasClip(canvas, CD_CLIPOFF);
-
- /* Adds a new page, or
- flushes the file, or
- flushes the screen, or
- swap the double buffer. */
- cdCanvasFlush(canvas);
}
void DrawVectorTextBox(cdCanvas* canvas, int x, int y, char* text)
@@ -1081,18 +1082,18 @@ void SimpleDrawTextAlign(cdCanvas* canvas)
#if 1
char* text_aligment_str[] = {
- "North (Ãyj)\nSecond Line (Ãyj)",
- "South (Ãyj)\nSecond Line (Ãyj)",
- "East (Ãyj)\nSecond Line (Ãyj)",
- "West (Ãyj)\nSecond Line (Ãyj)",
- "North East (Ãyj)\nSecond Line (Ãyj)",
- "North West (Ãyj)\nSecond Line (Ãyj)",
- "South East (Ãyj)\nSecond Line (Ãyj)",
- "South West (Ãyj)\nSecond Line (Ãyj)",
- "Center (Ãyj)\nSecond Line (Ãyj)",
- "Base Center (Ãyj)\nSecond Line (Ãyj)",
- "Base Right (Ãyj)\nSecond Line (Ãyj)",
- "Base Left (Ãyj)\nSecond Line (Ãyj)"
+ "North (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "South (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "East (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "West (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "North East (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "North West (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "South East (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "South West (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "Center (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "Base Center (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "Base Right (Ãyj)\nSecond Line (Ãyj)\nThird Line",
+ "Base Left (Ãyj)\nSecond Line (Ãyj)\nThird Line"
};
#else
char* text_aligment_str[] = {
diff --git a/test/simple/simple.led b/test/simple/simple.led
index a431079..d7ec30d 100644
--- a/test/simple/simple.led
+++ b/test/simple/simple.led
@@ -70,7 +70,7 @@ mnSurface = MENU
(
ITEM("Window", SimpleDrawWindow),
ITEM("Server Image", SimpleDrawImage),
- ITEM("Image RGB", SimpleDrawImageRGB)
+ ITEM("Image RGB", SimpleDrawImageRGB),
ITEM("OpenGL", SimpleDrawGL)
)
diff --git a/test/simple/simple_led.c b/test/simple/simple_led.c
index dbfb37b..db06a72 100644
--- a/test/simple/simple_led.c
+++ b/test/simple/simple_led.c
@@ -1,4 +1,4 @@
-/* Automatically generated by Iup ledc 2.6 */
+/* Automatically generated by Iup 3.0 LED Compiler to C. */
#include <stdlib.h>
#include <stdarg.h>
@@ -6,34 +6,17 @@
static Ihandle* named[ 13 ];
-static Ihandle* decl( char* name, Ihandle* elem, char* first, ...)
-{
- char *attr, *val;
- va_list arg;
- va_start (arg, first);
- attr = first;
- while (attr)
- {
- val = va_arg(arg,char*);
- IupSetAttribute( elem, attr, val );
- attr = va_arg(arg,char*);
- }
- va_end (arg);
- if(name) IupSetHandle( name, elem );
- return elem;
-}
-
void simple_loadled (void)
{
- named[0] = decl( "mnOpen", IupMenu(
+ named[0] = IupSetAtt( "mnOpen", IupMenu(
IupItem( "CGM - Binary", "SimplePlayCGMBin" ),
IupItem( "CGM - Text", "SimplePlayCGMText" ),
IupItem( "METAFILE", "SimplePlayMetafile" ),
IupItem( "WMF", "SimplePlayWMF" ),
IupItem( "EMF", "SimplePlayEMF" ),
NULL), NULL );
- named[1] = decl( "mnSaveAs", IupMenu(
+ named[1] = IupSetAtt( "mnSaveAs", IupMenu(
IupItem( "DEBUG", "SimpleDrawDebug" ),
IupItem( "CGM - Binary", "SimpleDrawCGMBin" ),
IupItem( "CGM - Text", "SimpleDrawCGMText" ),
@@ -47,7 +30,7 @@ void simple_loadled (void)
IupItem( "SVG", "SimpleDrawSVG" ),
IupItem( "WMF", "SimpleDrawWMF" ),
NULL), NULL );
- named[2] = decl( "mnFile", IupMenu(
+ named[2] = IupSetAtt( "mnFile", IupMenu(
IupSubmenu( "Open",
named[0] /* mnOpen */
),
@@ -60,24 +43,24 @@ void simple_loadled (void)
IupSeparator(),
IupItem( "Exit", "cmdExit" ),
NULL), NULL );
- named[3] = decl( "mnEdit", IupMenu(
+ named[3] = IupSetAtt( "mnEdit", IupMenu(
IupItem( "Copy as Metafile", "SimpleDrawClipboardMetafile" ),
IupItem( "Copy as EMF", "SimpleDrawClipboardEMF" ),
IupItem( "Copy as Bitmap", "SimpleDrawClipboardBitmap" ),
IupItem( "Paste", "SimplePlayClipboard" ),
NULL), NULL );
- named[4] = decl( "mnClipping", IupMenu(
+ named[4] = IupSetAtt( "mnClipping", IupMenu(
IupItem( "Off", "SimpleClippingOff" ),
IupItem( "Area", "SimpleClippingArea" ),
IupItem( "Polygon", "SimpleClippingPolygon" ),
IupItem( "Region", "SimpleClippingRegion" ),
NULL), NULL );
- named[5] = decl( "mnWriteMode", IupMenu(
+ named[5] = IupSetAtt( "mnWriteMode", IupMenu(
IupItem( "Replace", "SimpleReplace" ),
IupItem( "Xor", "SimpleXor" ),
IupItem( "Not Xor", "SimpleNotXor" ),
NULL), NULL );
- named[6] = decl( "mnOptions", IupMenu(
+ named[6] = IupSetAtt( "mnOptions", IupMenu(
IupSubmenu( "Clipping",
named[4] /* mnClipping */
),
@@ -88,19 +71,19 @@ void simple_loadled (void)
IupItem( "Transform", "SimpleTransform" ),
IupItem( "Context Plus", "SimpleContextPlus" ),
NULL), NULL );
- named[7] = decl( "mnSurface", IupMenu(
+ named[7] = IupSetAtt( "mnSurface", IupMenu(
IupItem( "Window", "SimpleDrawWindow" ),
IupItem( "Server Image", "SimpleDrawImage" ),
IupItem( "Image RGB", "SimpleDrawImageRGB" ),
IupItem( "OpenGL", "SimpleDrawGL" ),
NULL), NULL );
- named[8] = decl( "mnPrimitives", IupMenu(
+ named[8] = IupSetAtt( "mnPrimitives", IupMenu(
IupItem( "All", "SimpleAll" ),
IupItem( "Text Align", "SimpleTextAlign" ),
IupItem( "Text Fonts", "SimpleTextFonts" ),
IupItem( "Test", "SimpleTest" ),
NULL), NULL );
- named[9] = decl( "mnSimpleMenu", IupMenu(
+ named[9] = IupSetAtt( "mnSimpleMenu", IupMenu(
IupSubmenu( "File",
named[2] /* mnFile */
),
@@ -117,9 +100,9 @@ void simple_loadled (void)
named[8] /* mnPrimitives */
),
NULL), NULL );
- named[10] = decl( "SimpleCanvas", IupCanvas( "SimpleRepaint" ),
+ named[10] = IupSetAtt( "SimpleCanvas", IupCanvas( "SimpleRepaint" ),
"BORDER", "0", NULL );
- named[11] = decl( "SimpleDialog", IupDialog(
+ named[11] = IupSetAtt( "SimpleDialog", IupDialog(
named[10] /* SimpleCanvas */
),
"TITLE", "Simple Draw",