Tuesday, June 12, 2007

more haru (font_demo)

Downloaded font_demo.c from haru web site. Created new project : font_demo under haru solution. Did standard dependencies and include directories.

more haru

Specified haru include directory as needed.


Created haru solution / libhpdf project from within msvc. Name "libhpdf" chosen to match name in .def file provided in haru download.

more pngtest

Was getting zlib library not found. Worked around by modifying cygwin bash startup script to set DLL_PATH to contain location of zlib library and then modifying bat file that starts msvc append DLL_PATH to Path.

At this point pngtest compiles and runs and passes test ( after changing working directory to that of pngtest.png)

more pngtest

Removed explicit png/zlib library dependencies from pngtest.


Had to adjust include path for pngtest for zlib as done for png library.

more png

As written, the png project file had an explicit reference to the zlib library. I removed this and made the png library dependent on zlib. This seems cleaner.

cygwin environment

I wanted to be able to impose my cygwin environment vars inside of msvc so I copied and modifed cygwin.bat as follows:

@echo off

chdir C:\cygwin\bin

bash --login -i -c 'C:/WINDOWS/system32/cmd.exe /K "c:\cygwin_home\dave\workarea\env\startvc.bat"'
I also created a new desktop shortcut to call this .bat file

more png

Got some undeclared identifiers:

c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(315) : error C2065: 'PNG_ASM_FLAG_MMX_READ_COMBINE_ROW' : undeclared identifier
c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(1219) : error C2065: 'PNG_ASM_FLAG_MMX_READ_INTERLACE' : undeclared identifier
c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(3700) : error C2065: 'PNG_ASM_FLAG_MMX_READ_FILTER_SUB' : undeclared identifier
c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(3703) : error C2065: 'PNG_ASM_FLAG_MMX_READ_FILTER_UP' : undeclared identifier
c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(3706) : error C2065: 'PNG_ASM_FLAG_MMX_READ_FILTER_AVG' : undeclared identifier
c:\cygwin_home\dave\workarea\png\libpng-1.2.18\pngvcrd.c(3709) : error C2065: 'PNG_ASM_FLAG_MMX_READ_FILTER_PAETH' : undeclared identifier

These are resolved by defining PNG_MMX_CODE_SUPPORTED. I don't know if this is the best way (or even a good way) to fix this.

just noticed zlib v8

Just noticed that the zlib directory contains


which appears to have vc 8.0 sln/vcproj files

Probably this would have worked as well as converting the v6 projects but I'm not going to go back now - maybe some other time

more png

Changing the zlib project under png required that I also change the include path for png to get zlib.h . To make this a little less path dependent, I scripted the msvc startup to include a WORKAREA variable:

set WORKAREA=c:\cygwin_home\dave\workarea
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe"

Additional include directories for libpng are modified to include : "$(WORKAREA)\zlib\zlib-1.2.3"

compiling png

the png solution references a zlib project that does not exist. I deleted that reference and replaced it with the zlib project that I created when compiling zlib stand alone.

msvc project conversions

I'm using the free msvc express compiler (aka msvc 8.0). The zlib and png downloads provided v6 projects. I converted the v6 projects for use in msvc express. A v7.1 project also came with png but I stuck with v6 for (what seemed like) consistency.

compling zlib

had to download masm from microsoft to compile zlib. It turns out that zlib assembly has 4 compile errors that have to be fixed by hand:

inffas32.asm(647) : error A2070: invalid instruction operands
inffas32.asm(649) : error A2070: invalid instruction operands
inffas32.asm(663) : error A2070: invalid instruction operands
inffas32.asm(720) : error A2070: invalid instruction operands

All these are due to the same problem. Found the following fix online:

- movd mm7,[esi]
+ movd mm7,dword ptr[esi]

haru dependencies

haru depends on zlib and png. I downloaded all 3 of these and unpacked them into a directory called workarea.

haru itself has a windows specific download - use that one. I don't know if the source code is different but the one thing that this has that the generic does not is a def file that is needed to generate a .lib file.

Got the whole thing started under bzr with :

bzr init
bzr add
bzr commit -m "initializing"

I'm just trying out bazaar (bzr). Not sure yet how much I like it.

experimenting with pdf related code.

I spent a day or so playing with libhpdf (haru) which is a c library for pdf code generation. I eventually got it to build under msvc 8.0 . The next few posts will describe some of the things that I did to get it working.