Closed Bug 375506 Opened 16 years ago Closed 16 years ago

Fix for bug 372629 breaks Mingw - build error in gfxWindowsFonts.cpp


(Core :: Graphics, defect)

Windows XP
Not set





(Reporter: bengt.erik.soderstrom, Assigned: martijn.martijn)



(Keywords: regression)


(2 files, 1 obsolete file)

I think the fix for bug 372629 broke Mingw builds:
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In member function `HFONT

__* gfxWindowsFont::MakeHFONT()':
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:232: warning: comparison b
etween signed and unsigned integer expressions
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In function `PRBool Setup
TextRunFromGlyphs(gfxTextRun*, WCHAR*, HDC__*, gfxWindowsFont*)':
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:662: error: `GetTextExtent
ExPointI' was not declared in this scope
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:662: warning: unused varia
ble 'GetTextExtentExPointI'
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In member function `void
gfxWindowsFontGroup::InitTextRunGDI(gfxContext*, gfxTextRun*, const char*, PRUin
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:706: error: invalid conver
sion from `WCHAR*' to `WORD*'
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In member function `void
gfxWindowsFontGroup::InitTextRunGDI(gfxContext*, gfxTextRun*, const PRUnichar*,
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:730: error: invalid conver
sion from `WCHAR*' to `WORD*'
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In constructor `Uniscribe
Item::UniscribeItem(gfxContext*, HDC__*, const PRUnichar*, PRUint32, SCRIPT_ITEM
*, gfxWindowsFontGroup*)':
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:1426: warning: `UniscribeI
tem::mAlternativeString' will be initialized after
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:1420: warning:   `SCRIPT_I
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:894: warning:   when initi
alized here
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:1435: warning: `UniscribeI
tem::mNumGlyphs' will be initialized after
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:1434: warning:   `int Unis
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:894: warning:   when initi
alized here
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp: In member function `void
gfxWindowsFontGroup::InitTextRunUniscribe(gfxContext*, gfxTextRun*, const PRUnic
har*, PRUint32)':
d:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:1538: warning: unused vari
able 'fontIndex'
../../../dist/include/thebes/gfxWindowsFonts.h: At global scope:
../../../dist/include/thebes/gfxWindowsFonts.h:232: warning: 'PRUint8 CharRangeB
it(PRUint32)' defined but not used
make[6]: *** [gfxWindowsFonts.o] Error 1
make[6]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw/gfx/thebes/
make[5]: *** [libs] Error 2
make[5]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw/gfx/thebes'
make[4]: *** [libs] Error 2
make[4]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw/gfx'
make[3]: *** [libs_tier_gecko] Error 2
make[3]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make[2]: *** [tier_gecko] Error 2
make[2]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make[1]: *** [alldep] Error 2
make[1]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make: *** [alldep] Error 2
Component: Build Config → GFX: Thebes
Product: Firefox → Core
QA Contact: build.config → thebes
Blocks: 372629
Keywords: regression
I don't have mingw installed, can someone give me a patch? It shouldn't be hard except I'm not sure why GetTextExtentExPointI is undefined.
Attached patch patchSplinter Review
Sorry for the delay, this is a fix similar to the one in bug 373010.
This doesn't fix the 'GetTextExtentExPointI' issue. It seems to me that part should be fixed in wingdi.h.
Attachment #260344 - Flags: review?(roc)
Attached patch mingw patch (obsolete) — Splinter Review
Like this, the wingdi.h file resides (for me) in c:\mozilla\mingw\include\
Hans-Andreas, is this a correct patch? Or should this be somewhere fixed in Mozilla's repository? I have no idea where/how to submit patches to mingw.

This patch, combined with the previous patch makes thebes compile again.
Blocks: mingw
Indeed wingdi.h is not part of the mozilla repository,

You can submit patches to MinGW/w32api to its sourceforge page.  As an example you might take a look at one of the patches I have submitted there.
Submitting went very smooth and Danny Smith's responses were timely.

As soon as a w32api version containing your patch comes out, it would be useful if you post the version number here.

There is no unique location wingdi.h, it depends how you have configured your build environment.  It is just important that one only has it in ONE location, to be sure that one patches the right file :)

Thank you for keeping the MinGW build alive!
Thanks for the info.
It's pure self interest to keep the mingw build alive.

Apparently, something is missing in my patches, I get this build error (a linker error?):

rm -f thebes.dll
/cygdrive/c/mozilla/mozilla/build/cygwin-wrapper g++ -mno-cygwin -shared -Wl,--o
ut-implib -Wl,libthebes.dll.a -o thebes.dll  gfxASurface.o gfxAlphaRecovery.o gf
xContext.o gfxImageSurface.o gfxFont.o gfxFontTest.o gfxMatrix.o gfxFontMissingG
lyphs.o gfxPattern.o gfxPlatform.o gfxRect.o gfxSkipChars.o gfxTextRunCache.o gf
xWindowsFonts.o gfxWindowsPlatform.o gfxWindowsSurface.o gfxWindowsNativeDrawing
.o nsUnicodeRange.o gfxPDFSurface.o   ./module.res          -Wl,--whole-archive
../../../gfx/cairo/cairo/src/libmozcairo.a ../../../gfx/cairo/libpixman/src/libm
ozlibpixman.a  -Wl,--no-whole-archive ../../../dist/lib/libunicharutil_s.a -L../
../../dist/lib -lxpcom -lxpcom_core -L../../../dist/lib -lnspr4 -lplc4 -lplds4 -
L../../../modules/zlib/src -lmozz   -lm  -lgdi32 -lwinmm -lwsock32 -lusp10 -luui
d -lgdi32
Creating library file: libthebes.dll.a
gfxWindowsFonts.o: In function `Z22SetupTextRunFromGlyphsP10gfxTextRunPwP5HDC(gf
xWindowsFont *)':c:/mozilla/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp:662: unde
fined reference to `GetTextExtentExPointI@28'
collect2: ld returned 1 exit status
make[3]: *** [thebes.dll] Error 1
make[3]: Leaving directory `/cygdrive/c/mozilla/mozilla/gfx/thebes/src'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/cygdrive/c/mozilla/mozilla/gfx/thebes'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/cygdrive/c/mozilla/mozilla/gfx'
make: *** [all] Error 2

Probably you have to update the .def file as well, see e.g. my patch/file   	 usp10.h at

Then you have to rebuild (make) the w32api.

I do not remember the details, but with these hints you should be able to fix your problem quickly.
Attached patch mingw patchSplinter Review
Thanks! This makes it work.
For people who want to know how to download and build the w32api from source, see the instructions from Hans-Andreas in bug 328499, comment 48.
Attachment #260346 - Attachment is obsolete: true
Indeed, submitting to the sourceforge page went very smooth:
I have now tested your patch for Mingw and for gfxWindowsFonts.cpp. It works fine!
Maybe we can ask Pavlov who has lately made changes to gfxWindowsFonts.cpp to review and after OK check-in. (I have put him on the cc list.)
Hopefully the Mingw will be checked in soon.
Thanks again, Martijn. 
Checking in gfxWindowsFonts.cpp;
/cvsroot/mozilla/gfx/thebes/src/gfxWindowsFonts.cpp,v  <--  gfxWindowsFonts.cpp
new revision: 1.106; previous revision: 1.105

Checked into trunk.
Assignee: nobody → martijn.martijn
Closed: 16 years ago
Resolution: --- → FIXED
Attachment #260442 - Attachment is patch: true
Attachment #260442 - Attachment mime type: application/octet-stream → text/plain
I haven't heard back from ming sourceforge yet. (see comment 8). Not idea what's going on there.
Martijn, you might try to ask Danny Smith [dannysmith ()] to commit your patches.  He was very friendly and helpful with my patches about a year ago.
Ok, thanks. Indeed that helped. He responded almost immediately and it's now checked into the mingw repository.
You need to log in before you can comment on or make changes to this bug.