diff options
| author | Mirrorbot <mirrorbot@cogarr.net> | 2025-12-27 17:53:06 -0600 |
|---|---|---|
| committer | Mirrorbot <mirrorbot@cogarr.net> | 2025-12-27 17:53:06 -0600 |
| commit | 71e94ee161447b84c0eaabf6567f8fa62262cd3e (patch) | |
| tree | 391064cc6173a6fe75069af2fdc1978af12f623e /tools/IrrFontTool/newFontTool | |
| download | irrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.tar.gz irrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.tar.bz2 irrlicht-71e94ee161447b84c0eaabf6567f8fa62262cd3e.zip | |
Diffstat (limited to 'tools/IrrFontTool/newFontTool')
| -rw-r--r-- | tools/IrrFontTool/newFontTool/CFontTool.cpp | 801 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/CFontTool.h | 78 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/CVectorFontTool.h | 1199 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/Makefile | 38 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_v8.sln | 20 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj | 201 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_v9.sln | 20 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj | 202 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln | 20 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj | 207 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln | 20 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj | 207 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/irrFontTool_vc12.vcxproj | 207 | ||||
| -rw-r--r-- | tools/IrrFontTool/newFontTool/main.cpp | 493 |
14 files changed, 3713 insertions, 0 deletions
diff --git a/tools/IrrFontTool/newFontTool/CFontTool.cpp b/tools/IrrFontTool/newFontTool/CFontTool.cpp new file mode 100644 index 0000000..7c957ed --- /dev/null +++ b/tools/IrrFontTool/newFontTool/CFontTool.cpp @@ -0,0 +1,801 @@ +#include "CFontTool.h"
+#include "IXMLWriter.h"
+
+using namespace irr;
+
+const int fontsizes[] = {4,6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,56,68,72,0};
+
+inline u32 getTextureSizeFromSurfaceSize(u32 size)
+{
+ u32 ts = 0x01;
+ while(ts < size)
+ ts <<= 1;
+
+ return ts;
+}
+
+// windows specific
+#ifdef _IRR_WINDOWS_
+
+ const DWORD charsets[] = { ANSI_CHARSET, DEFAULT_CHARSET, OEM_CHARSET, BALTIC_CHARSET, GB2312_CHARSET, CHINESEBIG5_CHARSET,
+ EASTEUROPE_CHARSET, GREEK_CHARSET, HANGUL_CHARSET, MAC_CHARSET, RUSSIAN_CHARSET,
+ SHIFTJIS_CHARSET, SYMBOL_CHARSET, TURKISH_CHARSET, VIETNAMESE_CHARSET, JOHAB_CHARSET,
+ ARABIC_CHARSET, HEBREW_CHARSET, THAI_CHARSET, 0};
+
+ const wchar_t *setnames[] = {L"ANSI", L"All Available", L"OEM", L"Baltic", L"Chinese Simplified", L"Chinese Traditional",
+ L"Eastern European", L"Greek", L"Hangul", L"Macintosh", L"Russian",
+ L"Japanese", L"Symbol", L"Turkish", L"Vietnamese", L"Johab",
+ L"Arabic", L"Hebrew", L"Thai", 0};
+
+ // callback for adding font names
+ int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
+ DWORD FontType, LPARAM lParam)
+ {
+ CFontTool* t = (CFontTool*) lParam;
+ t->FontNames.push_back( core::stringw(lpelfe->elfFullName));
+ return 1;
+ }
+
+ //
+ // Constructor
+ //
+
+ CFontTool::CFontTool(IrrlichtDevice* device) : FontSizes(fontsizes),
+ Device(device), UseAlphaChannel(false),
+ // win specific
+ dc(0)
+ {
+ // init display context
+ dc = CreateDC(L"DISPLAY", L"DISPLAY", 0 ,0 );
+
+ // populate list of available character set names
+ for (int i=0; setnames[i] != 0; ++i)
+ CharSets.push_back( core::stringw(setnames[i]));
+
+ selectCharSet(0);
+ }
+
+ void CFontTool::selectCharSet(u32 currentCharSet)
+ {
+ if ( currentCharSet >= CharSets.size() )
+ return;
+
+ LOGFONTW lf;
+ lf.lfFaceName[0] = L'\0';
+ lf.lfCharSet = (BYTE) charsets[currentCharSet];
+ // HRESULT hr; // no error checking(!)
+
+ // clear font list
+ FontNames.clear();
+
+ // create list of available fonts
+ EnumFontFamiliesExW( dc, (LPLOGFONTW) &lf, (FONTENUMPROCW) EnumFontFamExProc, (LPARAM) this, 0);
+ }
+
+ bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha)
+ {
+ if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() )
+ return false;
+
+ UseAlphaChannel = alpha;
+ u32 currentImage = 0;
+
+ // create the font
+ HFONT font = CreateFontW(
+ -MulDiv(fontSize, GetDeviceCaps(dc, LOGPIXELSY), 72), 0,
+ 0,0,
+ bold ? FW_BOLD : 0,
+ italic, 0,0, charsets[charsetIndex], 0,0,
+ aa ? ANTIALIASED_QUALITY : 0,
+ 0, FontNames[fontIndex].c_str() );
+
+ if (!font)
+ return false;
+
+ SelectObject(dc, font);
+ SetTextAlign (dc,TA_LEFT | TA_TOP | TA_NOUPDATECP);
+
+ // get rid of the current textures/images
+ for (u32 i=0; i<currentTextures.size(); ++i)
+ currentTextures[i]->drop();
+ currentTextures.clear();
+
+ for (u32 i=0; i<currentImages.size(); ++i)
+ currentImages[i]->drop();
+ currentImages.clear();
+
+ // clear current image mappings
+ CharMap.clear();
+ // clear array
+ Areas.clear();
+
+ // get information about this font's unicode ranges.
+ s32 size = GetFontUnicodeRanges( dc, 0);
+ c8 *buf = new c8[size];
+ LPGLYPHSET glyphs = (LPGLYPHSET)buf;
+
+ GetFontUnicodeRanges( dc, glyphs);
+
+ // s32 TotalCharCount = glyphs->cGlyphsSupported;
+
+ s32 currentx=0, currenty=0, maxy=0;
+
+ for (u32 range=0; range < glyphs->cRanges; range++)
+ {
+ WCRANGE* current = &glyphs->ranges[range];
+
+ //maxy=0;
+
+ // loop through each glyph and write its size and position
+ for (s32 ch=current->wcLow; ch< current->wcLow + current->cGlyphs; ch++)
+ {
+ wchar_t currentchar = ch;
+
+ if ( IsDBCSLeadByte((BYTE) ch))
+ continue; // surrogate pairs unsupported
+
+ // get the dimensions
+ SIZE size;
+ ABC abc;
+ GetTextExtentPoint32W(dc, ¤tchar, 1, &size);
+ SFontArea fa;
+ fa.underhang = 0;
+ fa.overhang = 0;
+
+ if (GetCharABCWidthsW(dc, currentchar, currentchar, &abc)) // for unicode fonts, get overhang, underhang, width
+ {
+ size.cx = abc.abcB; // full font width (ignoring padding/underhang )
+ fa.underhang = abc.abcA; // underhang/padding left - can also be negative (in which case it's overhang left)
+ fa.overhang = abc.abcC; // overhang/padding right - can also be negative (in which case it's underhand right)
+
+ if (abc.abcB-abc.abcA+abc.abcC<1)
+ continue; // nothing of width 0
+ }
+ if (size.cy < 1)
+ continue;
+
+ //GetGlyphOutline(dc, currentchar, GGO_METRICS, &gm, 0, 0, 0);
+
+ //size.cx++; size.cy++;
+
+ // wrap around?
+ if (currentx + size.cx > (s32) textureWidth)
+ {
+ currenty += maxy;
+ currentx = 0;
+ if ((u32)(currenty + maxy) > textureHeight)
+ {
+ currentImage++; // increase Image count
+ currenty=0;
+ }
+ maxy = 0;
+ }
+ // add this char dimension to the current map
+
+ fa.rectangle = core::rect<s32>(currentx, currenty, currentx + size.cx, currenty + size.cy);
+ fa.sourceimage = currentImage;
+
+ CharMap.insert(currentchar, Areas.size());
+ Areas.push_back( fa );
+
+ currentx += size.cx +1;
+
+ if (size.cy+1 > maxy)
+ maxy = size.cy+1;
+ }
+ }
+ currenty += maxy;
+
+ u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currenty);
+
+ // delete the glyph set
+ delete [] buf;
+
+ currentImages.set_used(currentImage+1);
+ currentTextures.set_used(currentImage+1);
+
+ for (currentImage=0; currentImage < currentImages.size(); ++currentImage)
+ {
+ core::stringc logmsg = "Creating image ";
+ logmsg += (s32) (currentImage+1);
+ logmsg += " of ";
+ logmsg += (s32) currentImages.size();
+ Device->getLogger()->log(logmsg.c_str());
+ // no need for a huge final texture
+ u32 texHeight = textureHeight;
+ if (currentImage == currentImages.size()-1 )
+ texHeight = lastTextureHeight;
+
+ // make a new bitmap
+ HBITMAP bmp = CreateCompatibleBitmap(dc, textureWidth, texHeight);
+ HDC bmpdc = CreateCompatibleDC(dc);
+
+ LOGBRUSH lbrush;
+ lbrush.lbColor = RGB(0,0,0);
+ lbrush.lbHatch = 0;
+ lbrush.lbStyle = BS_SOLID;
+
+ HBRUSH brush = CreateBrushIndirect(&lbrush);
+ HPEN pen = CreatePen(PS_NULL, 0, 0);
+
+ HGDIOBJ oldbmp = SelectObject(bmpdc, bmp);
+ HGDIOBJ oldbmppen = SelectObject(bmpdc, pen);
+ HGDIOBJ oldbmpbrush = SelectObject(bmpdc, brush);
+ HGDIOBJ oldbmpfont = SelectObject(bmpdc, font);
+
+ SetTextColor(bmpdc, RGB(255,255,255));
+
+ Rectangle(bmpdc, 0,0,textureWidth,texHeight);
+ SetBkMode(bmpdc, TRANSPARENT);
+
+ // draw the letters...
+
+ // iterate through the tree
+ core::map<wchar_t, u32>::Iterator it = CharMap.getIterator();
+ while (!it.atEnd())
+ {
+ s32 currentArea = (*it).getValue();
+ wchar_t wch = (*it).getKey();
+ // sloppy but I couldn't be bothered rewriting it
+ if (Areas[currentArea].sourceimage == currentImage)
+ {
+ // draw letter
+ s32 sx = Areas[currentArea].rectangle.UpperLeftCorner.X - Areas[currentArea].underhang;
+ TextOutW(bmpdc, sx, Areas[currentArea].rectangle.UpperLeftCorner.Y, &wch, 1);
+
+ // if ascii font...
+ //SetPixel(bmpdc, Areas[currentArea].rectangle.UpperLeftCorner.X, Areas[currentArea].rectangle.UpperLeftCorner.Y, RGB(255,255,0));// left upper corner mark
+ }
+ it++;
+ }
+
+ // copy the font bitmap into a new irrlicht image
+ BITMAP b;
+ PBITMAPINFO pbmi;
+ WORD cClrBits;
+ u32 cformat;
+
+ // Retrieve the bitmap color format, width, and height.
+ GetObject(bmp, sizeof(BITMAP), (LPSTR)&b);
+
+ // Convert the color format to a count of bits.
+ cClrBits = (WORD)(b.bmPlanes * b.bmBitsPixel);
+
+ if (cClrBits <= 8) // we're not supporting these
+ cformat = -1;
+ else if (cClrBits <= 16)
+ cformat = video::ECF_A1R5G5B5;
+ else if (cClrBits <= 24)
+ cformat = video::ECF_R8G8B8;
+ else
+ cformat = video::ECF_A8R8G8B8;
+
+ pbmi = (PBITMAPINFO) LocalAlloc(LPTR,
+ sizeof(BITMAPINFOHEADER));
+
+ // Initialize the fields in the BITMAPINFO structure.
+
+ pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ pbmi->bmiHeader.biWidth = b.bmWidth;
+ pbmi->bmiHeader.biHeight = b.bmHeight;
+ pbmi->bmiHeader.biPlanes = b.bmPlanes;
+ pbmi->bmiHeader.biBitCount = b.bmBitsPixel;
+
+ // If the bitmap is not compressed, set the BI_RGB flag.
+ pbmi->bmiHeader.biCompression = BI_RGB;
+
+ // Compute the number of bytes in the array of color
+ // indices and store the result in biSizeImage.
+ // For Windows NT, the width must be DWORD aligned unless
+ // the bitmap is RLE compressed. This example shows this.
+ // For Windows 95/98/Me, the width must be WORD aligned unless the
+ // bitmap is RLE compressed.
+ pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8
+ * pbmi->bmiHeader.biHeight;
+ // Set biClrImportant to 0, indicating that all of the
+ // device colors are important.
+ pbmi->bmiHeader.biClrImportant = 0;
+
+ LPBYTE lpBits; // memory pointer
+
+ PBITMAPINFOHEADER pbih = (PBITMAPINFOHEADER) pbmi;
+ lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage);
+
+ GetDIBits(dc, bmp, 0, (WORD) pbih->biHeight, lpBits, pbmi, DIB_RGB_COLORS);
+
+ // DEBUG- copy to clipboard
+ //OpenClipboard(hWnd);
+ //EmptyClipboard();
+ //SetClipboardData(CF_BITMAP, bmp);
+ //CloseClipboard();
+
+ // flip bitmap
+ s32 rowsize = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8;
+ c8 *row = new c8[rowsize];
+ for (s32 i=0; i < (pbih->biHeight/2); ++i)
+ {
+ // grab a row
+ memcpy(row, lpBits + (rowsize * i), rowsize);
+ // swap row
+ memcpy(lpBits + (rowsize * i), lpBits + ((pbih->biHeight-1 -i) * rowsize ) , rowsize);
+ memcpy(lpBits + ((pbih->biHeight-1 -i) * rowsize ), row , rowsize);
+ }
+
+ bool ret = false;
+
+ if (cformat == video::ECF_A8R8G8B8)
+ {
+ // in this case the font should have an alpha channel, but since windows doesn't draw one
+ // we have to set one manually by going through all the pixels.. *sigh*
+
+ u8* m;
+ for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=4)
+ {
+ if (UseAlphaChannel)
+ {
+ if (m[0] > 0) // pixel has colour
+ {
+ m[3]=m[0]; // set alpha
+ m[0]=m[1]=m[2] = 255; // everything else is full
+ }
+ }
+ else
+ m[3]=255; // all pixels are full alpha
+ }
+
+ }
+ else if (cformat == video::ECF_A1R5G5B5)
+ {
+ u8* m;
+ for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=2)
+ {
+ WORD *p = (WORD*)m;
+ if (m[0] > 0 || !UseAlphaChannel) // alpha should be set
+ *p |= 0x8000; // set alpha bit
+ }
+ }
+ else
+ {
+ cformat = -1;
+ }
+
+ // make a texture from the image
+ if (cformat != -1)
+ {
+ // turn mip-mapping off
+ bool b = Device->getVideoDriver()->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
+ currentImages[currentImage] = Device->getVideoDriver()->createImageFromData((video::ECOLOR_FORMAT)cformat, core::dimension2d<u32>(textureWidth,texHeight), (void*)lpBits);
+ Device->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS,b);
+ }
+ else
+ {
+ Device->getLogger()->log("Couldn't create font, your pixel format is unsupported.");
+ }
+
+ // free memory and windows resources
+ // sloppy I know, but I only intended to create one image at first.
+ delete [] row;
+ LocalFree(pbmi);
+ GlobalFree(lpBits);
+ DeleteDC(bmpdc);
+ DeleteObject(brush);
+ DeleteObject(pen);
+ DeleteObject(bmp);
+
+ if (currentImages[currentImage])
+ {
+ // add texture
+ currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]);
+ currentTextures[currentImage]->grab();
+ }
+ else
+ {
+ Device->getLogger()->log("Something went wrong, aborting.");
+ // drop all images
+ DeleteObject(font);
+ return false;
+ }
+ } // looping through each texture
+ DeleteObject(font);
+ return true;
+ }
+
+#else
+
+ CFontTool::CFontTool(IrrlichtDevice *device) : FontSizes(fontsizes), Device(device), UseAlphaChannel(false)
+ {
+ if (!XftInitFtLibrary())
+ {
+ core::stringc logmsg = "XFT not found\n";
+ Device->getLogger()->log(logmsg.c_str());
+ exit(EXIT_FAILURE);
+ }
+
+ /* Get a list of the font foundries, storing them in a set to sort */
+ std::set<core::stringw> foundries;
+ Display* display = (Display*)Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display;
+ XftFontSet* fonts = XftListFonts(display, DefaultScreen(display), 0, XFT_FOUNDRY, 0);
+ for (int i = 0; i < fonts->nfont; i++)
+ {
+ char *foundry;
+ XftPatternGetString(fonts->fonts[i], XFT_FOUNDRY, 0, &foundry);
+ core::stringw tmp(foundry);
+ foundries.insert(tmp);
+ }
+ XftFontSetDestroy(fonts);
+
+ /* Copy the sorted list into the array */
+ CharSets.clear();
+ for (std::set<core::stringw>::iterator i = foundries.begin(); i != foundries.end(); i++)
+ CharSets.push_back((*i).c_str());
+ selectCharSet(0);
+ }
+
+ /* Note: There must be some trick for using strings as pattern parameters to XftListFonts because
+ no matter how I specify a string, I end up with an intermittent segfault. Since XftFontList is
+ just calling FcFontList, that's what I'll do too since that works OK */
+ void CFontTool::selectCharSet(u32 currentCharSet)
+ {
+ /* Get a list of the font families, storing them in a set to sort */
+ char foundry[256];
+ sprintf(&foundry[0],"%ls",CharSets[currentCharSet].c_str());
+ std::set<core::stringw> families;
+ XftPattern *pattern = FcPatternCreate();
+ XftPatternAddString(pattern, FC_FOUNDRY, &foundry[0]);
+ XftObjectSet *objectset = FcObjectSetCreate();
+ XftObjectSetAdd(objectset, XFT_FOUNDRY);
+ XftObjectSetAdd(objectset, XFT_FAMILY);
+ FcFontSet *fonts = FcFontList(NULL, pattern, objectset);
+
+ for (int i = 0; i < fonts->nfont; i++)
+ {
+ char* ptr;
+ XftPatternGetString(fonts->fonts[i], XFT_FAMILY, 0, &ptr);
+ core::stringw family(ptr);
+ families.insert(family);
+ }
+ XftPatternDestroy(pattern);
+ FcObjectSetDestroy(objectset);
+
+ /* Copy the sorted list into the array */
+ FontNames.clear();
+ for (std::set<core::stringw>::iterator i = families.begin(); i != families.end(); i++)
+ FontNames.push_back((*i).c_str());
+ }
+
+ bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha)
+ {
+ if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() )
+ return false;
+
+ Display *display = (Display*) Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display;
+ u32 screen = DefaultScreen(display);
+ Window win = RootWindow(display, screen);
+ Visual *visual = DefaultVisual(display, screen);
+ UseAlphaChannel = alpha;
+ u32 currentImage = 0;
+
+ XftResult result;
+ XftPattern *request = XftPatternCreate();
+ char foundry[256], family[256];
+ sprintf(&foundry[0],"%ls",CharSets[charsetIndex].c_str());
+ sprintf(&family[0],"%ls",FontNames[fontIndex].c_str());
+ XftPatternAddString(request, XFT_FOUNDRY, &foundry[0]);
+ XftPatternAddString(request, XFT_FAMILY, &family[0]);
+ XftPatternAddInteger(request, XFT_PIXEL_SIZE, fontSize);
+ XftPatternAddInteger(request, XFT_WEIGHT, bold ? XFT_WEIGHT_BLACK : XFT_WEIGHT_LIGHT);
+ XftPatternAddInteger(request, XFT_SLANT, italic ? XFT_SLANT_ITALIC : XFT_SLANT_ROMAN);
+ XftPatternAddBool(request, XFT_ANTIALIAS, aa);
+
+ /* Find the closest font that matches the user choices and open it and check if the returned
+ font has anti aliasing enabled by default, even if it wasn't requested */
+ FcBool aaEnabled;
+ XftPattern *found = XftFontMatch(display, DefaultScreen(display), request, &result);
+ XftPatternGetBool(found, XFT_ANTIALIAS, 0, &aaEnabled);
+ aa = aaEnabled;
+ XftFont *font = XftFontOpenPattern(display, found);
+
+ // get rid of the current textures/images
+ for (u32 i=0; i<currentTextures.size(); ++i)
+ currentTextures[i]->drop();
+ currentTextures.clear();
+ for (u32 i=0; i<currentImages.size(); ++i)
+ currentImages[i]->drop();
+ currentImages.clear();
+ CharMap.clear();
+ Areas.clear();
+
+ /* Calculate the max height of the font. Annoyingly, it seems that the height property of the font
+ is the maximum height of any single character, but a string of characters, aligned along their
+ baselines, can exceed this figure. Because I don't know any better way of doing it, I'm going to
+ have to use the brute force method.
+
+ Note: There will be a certain number of charters in a font, however they may not be grouped
+ consecutively, and could in fact be spread out with many gaps */
+ u32 maxY = 0;
+ u32 charsFound = 0;
+ for (FT_UInt charCode = 0; charsFound < FcCharSetCount(font->charset); charCode++)
+ {
+ if (!XftCharExists(display, font, charCode))
+ continue;
+
+ charsFound++;
+
+ XGlyphInfo extents;
+ XftTextExtents32(display, font, &charCode, 1, &extents);
+ if ((extents.xOff <= 0) && (extents.height <= 0))
+ continue;
+
+ /* Calculate the width and height, adding 1 extra pixel if anti aliasing is enabled */
+ u32 chWidth = extents.xOff + (aa ? 1 : 0);
+ u32 chHeight = (font->ascent - extents.y + extents.height) + (aa ? 1 : 0);
+ if (chHeight > maxY)
+ maxY = chHeight;
+
+ /* Store the character details here */
+ SFontArea fontArea;
+ fontArea.rectangle = core::rect<s32>(0, 0, chWidth, chHeight);
+ CharMap.insert(charCode, Areas.size());
+ Areas.push_back(fontArea);
+ }
+ core::stringc logmsg = "Found ";
+ logmsg += (s32) (CharMap.size() + 1);
+ logmsg += " characters";
+ Device->getLogger()->log(logmsg.c_str());
+
+ /* Get the size of the chars and allocate them a position on a texture. If the next character that
+ is added would be outside the width or height of the texture, then a new texture is added */
+ u32 currentX = 0, currentY = 0, rowY = 0;
+ for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++)
+ {
+ s32 currentArea = (*it).getValue();
+ SFontArea *fontArea = &Areas[currentArea];
+ u32 chWidth = fontArea->rectangle.LowerRightCorner.X;
+ u32 chHeight = fontArea->rectangle.LowerRightCorner.Y;
+
+ /* If the width of this char will exceed the textureWidth then start a new row */
+ if ((currentX + chWidth) > textureWidth)
+ {
+ currentY += rowY;
+ currentX = 0;
+
+ /* If the new row added to the texture exceeds the textureHeight then start a new texture */
+ if ((currentY + rowY) > textureHeight)
+ {
+ currentImage++;
+ currentY = 0;
+ }
+ rowY = 0;
+ }
+
+ /* Update the area with the current x and y and texture */
+ fontArea->rectangle = core::rect<s32>(currentX, currentY, currentX + chWidth, currentY + chHeight);
+ fontArea->sourceimage = currentImage;
+ currentX += chWidth + 1;
+ if (chHeight + 1 > rowY)
+ rowY = chHeight + 1;
+ }
+
+ /* The last row of chars and the last texture weren't accounted for in the loop, so add them here */
+ currentY += rowY;
+ u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currentY);
+ currentImages.set_used(currentImage + 1);
+ currentTextures.set_used(currentImage + 1);
+
+ /* Initialise colours */
+ XftColor colFore, colBack;
+ XRenderColor xFore = {0xffff, 0xffff, 0xffff, 0xffff};
+ XRenderColor xBack = {0x0000, 0x0000, 0x0000, 0xffff};
+ XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xFore, &colFore);
+ XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xBack, &colBack);
+
+ /* Create a pixmap that is large enough to hold any character in the font */
+ Pixmap pixmap = XCreatePixmap(display, win, textureWidth, maxY, DefaultDepth(display, screen));
+ XftDraw *draw = XftDrawCreate(display, pixmap, visual, DefaultColormap(display, screen));
+
+ /* Render the chars */
+ for (currentImage = 0; currentImage < currentImages.size(); ++currentImage)
+ {
+ core::stringc logmsg = "Creating image ";
+ logmsg += (s32) (currentImage+1);
+ logmsg += " of ";
+ logmsg += (s32) currentImages.size();
+ Device->getLogger()->log(logmsg.c_str());
+
+ /* The last texture that is saved is vertically shrunk to fit the characters drawn on it */
+ u32 texHeight = textureHeight;
+ if (currentImage == currentImages.size() - 1)
+ texHeight = lastTextureHeight;
+
+ /* The texture that holds this "page" of characters */
+ currentImages[currentImage] = Device->getVideoDriver()->createImage(video::ECF_A8R8G8B8, core::dimension2du(textureWidth, texHeight));
+ currentImages[currentImage]->fill(video::SColor(alpha ? 0 : 255,0,0,0));
+
+ for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++)
+ {
+ FcChar32 wch = (*it).getKey();
+ s32 currentArea = (*it).getValue();
+ if (Areas[currentArea].sourceimage == currentImage)
+ {
+ SFontArea *fontArea = &Areas[currentArea];
+ u32 chWidth = fontArea->rectangle.LowerRightCorner.X - fontArea->rectangle.UpperLeftCorner.X;
+ u32 chHeight = fontArea->rectangle.LowerRightCorner.Y - fontArea->rectangle.UpperLeftCorner.Y;
+
+ /* Draw the glyph onto the pixmap */
+ XGlyphInfo extents;
+ XftDrawRect(draw, &colBack, 0, 0, chWidth, chHeight);
+ XftTextExtents32(display, font, &wch, 1, &extents);
+ XftDrawString32(draw, &colFore, font, extents.x, extents.y, &wch, 1);
+
+ /* Convert the pixmap into an image, then copy it onto the Irrlicht texture, pixel by pixel.
+ There's bound to be a faster way, but this is adequate */
+ u32 xDest = fontArea->rectangle.UpperLeftCorner.X;
+ u32 yDest = fontArea->rectangle.UpperLeftCorner.Y + font->ascent - extents.y;
+ XImage *image = XGetImage(display, pixmap, 0, 0, chWidth, chHeight, 0xffffff, XYPixmap);
+ if (image)
+ {
+ for (u32 ySrc = 0; ySrc < chHeight; ySrc++)
+ for (u32 xSrc = 0; xSrc < chWidth; xSrc++)
+ {
+ /* Get the pixel colour and break it down into rgb components */
+ u32 col = XGetPixel(image, xSrc, ySrc);
+ u32 a = 255;
+ u32 r = col & visual->red_mask;
+ u32 g = col & visual->green_mask;
+ u32 b = col & visual->blue_mask;
+ while (r > 0xff) r >>= 8;
+ while (g > 0xff) g >>= 8;
+ while (b > 0xff) b >>= 8;
+
+ /* To make the background transparent, set the colour to 100% white and the alpha to
+ the average of the three rgb colour components to maintain the anti-aliasing */
+ if (alpha)
+ {
+ a = (r + g + b) / 3;
+ r = 255;
+ g = 255;
+ b = 255;
+ }
+ currentImages[currentImage]->setPixel(xDest + xSrc,yDest + ySrc,video::SColor(a,r,g,b));
+ }
+ image->f.destroy_image(image);
+ }
+ }
+ }
+
+ /* Add the texture to the list */
+ currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]);
+ currentTextures[currentImage]->grab();
+ }
+
+ XftColorFree (display, visual, DefaultColormap(display, screen), &colFore);
+ XftColorFree (display, visual, DefaultColormap(display, screen), &colBack);
+ XftFontClose(display,font);
+ XftPatternDestroy(request);
+ XftDrawDestroy(draw);
+ XFreePixmap(display, pixmap);
+ return true;
+ }
+#endif
+
+ CFontTool::~CFontTool()
+ {
+#ifdef _IRR_WINDOWS_
+ // destroy display context
+ if (dc)
+ DeleteDC(dc);
+#endif
+
+ // drop textures+images
+ for (u32 i=0; i<currentTextures.size(); ++i)
+ currentTextures[i]->drop();
+ currentTextures.clear();
+
+ for (u32 i=0; i<currentImages.size(); ++i)
+ currentImages[i]->drop();
+ currentImages.clear();
+ }
+
+bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format)
+{
+ if (currentImages.size() == 0)
+ {
+ Device->getLogger()->log("No image data to write, aborting.");
+ return false;
+ }
+
+ core::stringc fn = filename;
+ core::stringc imagename = filename;
+ fn += ".xml";
+
+ io::IXMLWriter *writer = Device->getFileSystem()->createXMLWriter(fn.c_str());
+
+ // header and line breaks
+ writer->writeXMLHeader();
+ writer->writeLineBreak();
+
+ // write information
+ writer->writeElement(L"font", false, L"type", L"bitmap");
+ writer->writeLineBreak();
+ writer->writeLineBreak();
+
+ // write images and link to them
+ for (u32 i=0; i<currentImages.size(); ++i)
+ {
+ imagename = filename;
+ imagename += (s32)i;
+ imagename += ".";
+ imagename += format;
+ Device->getVideoDriver()->writeImageToFile(currentImages[i],imagename.c_str());
+
+ writer->writeElement(L"Texture", true,
+ L"index", core::stringw(i).c_str(),
+ L"filename", core::stringw(imagename.c_str()).c_str(),
+ L"hasAlpha", UseAlphaChannel ? L"true" : L"false");
+ writer->writeLineBreak();
+ }
+
+ writer->writeLineBreak();
+
+ // write each character
+ core::map<wchar_t, u32>::Iterator it = CharMap.getIterator();
+ while (!it.atEnd())
+ {
+ SFontArea &fa = Areas[(*it).getValue()];
+
+ wchar_t c[2];
+ c[0] = (*it).getKey();
+ c[1] = L'\0';
+ core::stringw area, under, over, image;
+ area = core::stringw(fa.rectangle.UpperLeftCorner.X);
+ area += L", ";
+ area += fa.rectangle.UpperLeftCorner.Y;
+ area += L", ";
+ area += fa.rectangle.LowerRightCorner.X;
+ area += L", ";
+ area += fa.rectangle.LowerRightCorner.Y;
+
+ core::array<core::stringw> names;
+ core::array<core::stringw> values;
+ names.clear();
+ values.clear();
+ // char
+ names.push_back(core::stringw(L"c"));
+ values.push_back(core::stringw(c));
+ // image number
+ if (fa.sourceimage != 0)
+ {
+ image = core::stringw(fa.sourceimage);
+ names.push_back(core::stringw(L"i"));
+ values.push_back(image);
+ }
+ // rectangle
+ names.push_back(core::stringw(L"r"));
+ values.push_back(area);
+
+ if (fa.underhang != 0)
+ {
+ under = core::stringw(fa.underhang);
+ names.push_back(core::stringw(L"u"));
+ values.push_back(under);
+ }
+ if (fa.overhang != 0)
+ {
+ over = core::stringw(fa.overhang);
+ names.push_back(core::stringw(L"o"));
+ values.push_back(over);
+ }
+ writer->writeElement(L"c", true, names, values);
+
+ writer->writeLineBreak();
+ it++;
+ }
+
+ writer->writeClosingTag(L"font");
+
+ writer->drop();
+
+ Device->getLogger()->log("Bitmap font saved.");
+
+ return true;
+}
diff --git a/tools/IrrFontTool/newFontTool/CFontTool.h b/tools/IrrFontTool/newFontTool/CFontTool.h new file mode 100644 index 0000000..5a35938 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/CFontTool.h @@ -0,0 +1,78 @@ +#ifndef __IRR_FONT_TOOL_INCLUDED__
+#define __IRR_FONT_TOOL_INCLUDED__
+
+
+#include "irrlicht.h"
+
+#if defined(_IRR_WINDOWS_)
+ #ifdef _MBCS
+ #undef _MBCS
+ #endif
+
+ #define UNICODE
+ #define _WIN32_WINNT 0x0500
+ #include "windows.h"
+#else
+ #ifdef _IRR_COMPILE_WITH_X11_
+ #include <X11/Xlib.h>
+ #endif
+ #include <X11/Xft/Xft.h>
+ #include <set>
+#endif
+
+
+namespace irr {
+ class CFontTool : public irr::IReferenceCounted
+ {
+ public:
+ CFontTool(irr::IrrlichtDevice* device);
+ ~CFontTool();
+
+ virtual bool makeBitmapFont(u32 fontIndex, u32 charsetIndex,
+ s32 fontSize, u32 texturewidth, u32 textureHeight,
+ bool bold, bool italic, bool aa, bool alpha);
+
+ virtual bool saveBitmapFont(const c8* filename, const c8* format);
+
+ virtual void selectCharSet(u32 currentCharSet);
+
+ struct SFontArea
+ {
+ SFontArea() : rectangle(), underhang(0), overhang(0), sourceimage(0) {}
+ core::rect<s32> rectangle;
+ s32 underhang;
+ s32 overhang;
+ u32 sourceimage;
+ };
+
+ /* struct SFontMap
+ {
+ SFontMap() : areas(), start(0), count(0) {}
+ core::array< SFontArea > areas;
+ s32 start;
+ s32 count;
+ };*/
+
+
+
+ core::array<core::stringw> FontNames;
+ core::array<core::stringw> CharSets;
+ //core::array<SFontMap> Mappings;
+ core::array<SFontArea> Areas;
+ core::map<wchar_t, u32> CharMap;
+
+ core::array<video::ITexture*> currentTextures;
+ core::array<video::IImage*> currentImages;
+ const int *FontSizes;
+ IrrlichtDevice *Device;
+
+ bool UseAlphaChannel;
+
+ // windows
+ #ifdef _IRR_WINDOWS_
+ HDC dc;
+ #endif
+
+ };
+}
+#endif // __IRR_FONT_TOOL_INCLUDED__
diff --git a/tools/IrrFontTool/newFontTool/CVectorFontTool.h b/tools/IrrFontTool/newFontTool/CVectorFontTool.h new file mode 100644 index 0000000..05a9c79 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/CVectorFontTool.h @@ -0,0 +1,1199 @@ +/*
+ Vector font tool - Gaz Davidson December 2006-2012
+
+ I noticed bitmap fonts were taking massive amounts of video memory at reasonable sizes,
+ so I decided to make a vector font. I always wanted to try converting pixels to triangles...
+
+ And I failed! This is a collection of the ugliest, bloated, most inneficient algorithms
+ i've ever written, but its kinda working so I'm not changing it.
+*/
+
+#ifndef __VECTOR_FONT_TOOL_INCLUDED__
+#define __VECTOR_FONT_TOOL_INCLUDED__
+
+#include "irrlicht.h"
+#include "CFontTool.h"
+#include <assert.h>
+
+using namespace irr;
+using namespace video;
+
+struct STriangleList
+{
+ core::array<core::vector2df> positions;
+ core::array<u16> indexes;
+
+ // for adding one triangle list to another,
+ // these triangles share positions, but dont share triangles
+ STriangleList& operator+=(STriangleList &other)
+ {
+ core::matrix4 m;
+ core::array<s32> map;
+ map.set_used(other.positions.size());
+
+ for (u32 i=0; i<map.size(); ++i)
+ map[i]=-1;
+
+ for (u32 i=0; i<positions.size(); ++i)
+ for (u32 j=0; j<map.size(); ++j)
+ if ( positions[i] == other.positions[j] )
+ map[j] = i;
+
+ for (u32 i=0; i<map.size(); ++i)
+ if (map[i] == -1)
+ {
+ positions.push_back(other.positions[i]);
+ map[i] = positions.size()-1;
+ }
+
+ // add triangles
+ for (u32 i=0; i<other.indexes.size(); ++i)
+ indexes.push_back((u32)map[other.indexes[i]]);
+
+ return *this;
+ }
+
+ // functions for building triangles for shapes,
+ // each shape can't have duplicate triangles
+ bool hasTriangle(core::vector2df a, core::vector2df b, core::vector2df c)
+ {
+ // make sure the triangle is wound correctly
+ if (core::line2df(a,b).getPointOrientation(c) < 0)
+ { core::vector2df tmp=a; a=b; b=tmp; }
+
+ u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff;
+ // Find each vertex
+ for (u32 i=0; i < positions.size() && (ia==(u32)-1||ib==(u32)-1||ic==(u32)-1) ; ++i)
+ {
+ if (positions[i] == a)
+ ia = i;
+ if (positions[i] == b)
+ ib = i;
+ if (positions[i] == c)
+ ic = i;
+ }
+
+ if (ia==0xffffffff)
+ {
+ return false;
+ }
+ if (ib==0xffffffff)
+ {
+ return false;
+ }
+ if (ic==0xffffffff)
+ {
+ return false;
+ }
+
+ for (u32 i=0; i<indexes.size(); i+=3)
+ if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) ||
+ (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) ||
+ (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) )
+ return true;
+
+ return false;
+ }
+
+ void add(core::vector2df a, core::vector2df b, core::vector2df c)
+ {
+
+ // make sure the triangle is wound correctly
+ if (core::line2df(a,b).getPointOrientation(c) < 0)
+ {
+ core::vector2df tmp=a; a=b; b=tmp;
+ }
+
+ u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff;
+ // no duplicate vertex positions allowed...
+ for (u32 i=0; i < positions.size() && (ia==-1||ib==-1||ic==-1) ; ++i)
+ {
+ if (positions[i] == a)
+ ia = i;
+ if (positions[i] == b)
+ ib = i;
+ if (positions[i] == c)
+ ic = i;
+ }
+ bool found=true;
+ if (ia==0xffffffff)
+ {
+ ia = positions.size();
+ positions.push_back(a);
+ found=false;
+ }
+ if (ib==0xffffffff)
+ {
+ ib = positions.size();
+ positions.push_back(b);
+ found=false;
+ }
+ if (ic==0xffffffff)
+ {
+ ic = positions.size();
+ positions.push_back(c);
+ found=false;
+ }
+
+ // no duplicate triangles allowed
+ if (found)
+ {
+ found=false;
+ for (u32 i=0; i<indexes.size(); i+=3)
+ {
+ if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) ||
+ (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) ||
+ (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) )
+ {
+ found=true;
+ break;
+ }
+ }
+ }
+
+ if (!found)
+ {
+ indexes.push_back(ia);
+ indexes.push_back(ib);
+ indexes.push_back(ic);
+ }
+ }
+};
+
+// finds groups of pixels and triangulates them
+class CGroupFinder
+{
+public:
+ CGroupFinder(bool *memory, s32 w, s32 h, IrrlichtDevice *dev):
+ width(w), height(h), mem(memory), Device(dev)
+ {
+ refbuffer.set_used(w*h);
+ for (u32 i=0; i<refbuffer.size(); ++i)
+ refbuffer[i]=0;
+ // find groups of pixels
+ findGroups();
+ removeGroups();
+
+ // triangulate
+ for (u32 i=0; i<groups.size(); ++i)
+ {
+ groups[i].triangulate();
+ }
+ }
+
+ // contains a clockwise edge line
+ struct SEdge
+ {
+ SEdge() : positions() { }
+
+ core::array<core::position2di> positions;
+
+ bool isMember(s32 x, s32 y)
+ {
+ for (u32 i=0; i<positions.size(); ++i)
+ if (positions[i].X == x && positions[i].Y == y)
+ return true;
+ return false;
+ }
+
+ // reduces the number of points in the edge
+ void reduce(s32 level=0)
+ {
+ // level 0- remove points on the same line
+ for (u32 i=1; i < positions.size()-1; ++i)
+ {
+ // same point as the last one?! shouldnt happen, dunno why it does :|
+ if (positions[i-1] == positions[i])
+ {
+ positions.erase(i--);
+ continue;
+ }
+
+ // get headings
+ core::vector2d<f32> h1((f32)(positions[i-1].X - positions[i].X),(f32)(positions[i-1].Y - positions[i].Y)),
+ h2((f32)(positions[i].X - positions[i+1].X),(f32)(positions[i].Y - positions[i+1].Y));
+ h1.normalize();
+ h2.normalize();
+
+ if (h1==h2) // erase the current point
+ positions.erase(i--);
+ }
+
+ // level 1- if point1 points at point3, we can skip point2
+ // level 2+ allow a deviation of level-1
+
+ }
+
+ };
+
+ // contains an array of lines for triangulation
+ struct SLineList
+ {
+ core::array<core::line2df> lines;
+ SLineList() : lines() { }
+ void addEdge(const SEdge &edge)
+ {
+ // adds lines to the buffer
+ for (u32 i=1; i<edge.positions.size(); ++i)
+ addLine(core::line2df((f32)edge.positions[i-1].X, (f32)edge.positions[i-1].Y,
+ (f32)edge.positions[i].X, (f32)edge.positions[i].Y ));
+ }
+ void addLine( const core::line2df &line )
+ {
+ // no dupes!
+ if (!hasLine(line))
+ lines.push_back(line);
+ }
+ bool hasLine( const core::line2df &line )
+ {
+ for (u32 i=0; i<lines.size(); ++i)
+ if (line == lines[i] || (line.start == lines[i].end && line.end == lines[i].start) )
+ return true;
+ return false;
+ }
+
+ bool crossesWith( core::line2df l, core::vector2df p)
+ {
+ // inside checks only work with clockwise triangles
+ if (l.getPointOrientation(p) < 0)
+ { core::vector2df tmp=l.start; l.start=l.end; l.end=tmp; }
+
+ // make the 3 triangle edges
+ core::line2df &la=l, lb(l.end,p), lc(p,l.start);
+
+ // test every line in the list
+ for (u32 i=0; i<lines.size(); ++i)
+ {
+ core::line2df &l2 = lines[i];
+
+ // the triangle isn't allowed to enclose any points
+ // triangles are clockwise, so if to the right of all 3 lines, it's enclosed
+ if (la.getPointOrientation(l2.start) > 0 &&
+ lb.getPointOrientation(l2.start) > 0 &&
+ lc.getPointOrientation(l2.start) > 0)
+ return true;
+ //if (la.getPointOrientation(l2.start) < 0 &&
+ // lb.getPointOrientation(l2.start) < 0 &&
+ // lc.getPointOrientation(l2.start) < 0)
+ // return true;
+
+ core::vector2df out;
+ //if (la.intersectWith(l2,out))
+ // if (out != la.start && out != la.end &&
+ // out != l2.start && out != l2.end)
+ // return true;
+ if (lb.intersectWith(l2,out))
+ if (!out.equals(lb.start) && !out.equals(lb.end) &&
+ !out.equals(l2.start) && !out.equals(l2.end))
+ return true;
+ if (lc.intersectWith(l2,out))
+ if (!out.equals(lc.start) && !out.equals(lc.end) &&
+ !out.equals(l2.start) && !out.equals(l2.end))
+ return true;
+
+ // my shit intersection code only works with lines in certain directions :(
+ if (l2.intersectWith(lb,out))
+ if (!out.equals(lb.start) && !out.equals(lb.end) &&
+ !out.equals(l2.start) && !out.equals(l2.end))
+ return true;
+ if (l2.intersectWith(lc,out))
+ if (!out.equals(lc.start) && !out.equals(lc.end) &&
+ !out.equals(l2.start) && !out.equals(l2.end))
+ return true;
+
+
+ if (lb.isPointOnLine(l2.start) && l2.start != lb.start && l2.start != lb.end)
+ return true;
+ if (lc.isPointOnLine(l2.start) && l2.start != lc.start && l2.start != lc.end)
+ return true;
+
+ }
+ return false;
+ }
+ };
+
+ // an area of adjacent pixels
+ struct SPixelGroup
+ {
+ SPixelGroup(IrrlichtDevice *device) : triangles(), pixelWidth(0), pixelHeight(0),
+ Device(device) {}
+
+ core::array<core::position2di> pixels;
+ core::array<SEdge> edges;
+ STriangleList triangles;
+ core::array<SLineList> ll;
+ core::array<bool> isMemberCache;
+ s32 pixelWidth;
+ s32 pixelHeight;
+ IrrlichtDevice *Device;
+
+ void triangulate()
+ {
+
+ // find edges in this group
+ makeEdges();
+
+ // triangulate the group
+ makeTriangles();
+
+ }
+
+ void drawTriangle( core::line2df line, core::vector2df point)
+ {
+ //const u32 endt = Device->getTimer()->getTime() + t;
+ f32 scale = 5;
+
+
+ //while(Device->getTimer()->getTime() < endt )
+ //{
+ Device->run();
+ Device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0));
+ for (u32 v=0;v<ll.size(); ++v)
+ for (u32 h=0;h<ll[v].lines.size(); ++h)
+ {
+ core::line2df ¤tline = ll[v].lines[h];
+ core::position2di st = core::position2di((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50);
+ core::position2di en = core::position2di((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50);
+
+ Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,255,255));
+ }
+ // draw this triangle
+ const core::position2di st((s32)(line.start.X*scale)+50, (s32)(line.start.Y*scale)+50);
+ const core::position2di en((s32)(line.end.X*scale)+50, (s32)(line.end.Y*scale)+50);
+ const core::position2di p((s32)(point.X*scale)+50, (s32)(point.Y*scale)+50);
+ Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0));
+ Device->getVideoDriver()->draw2DLine(en,p, SColor(255,0,255,0));
+ Device->getVideoDriver()->draw2DLine(p,st, SColor(255,0,0,255));
+
+ Device->getVideoDriver()->endScene();
+ //}
+ }
+
+ void makeTriangles()
+ {
+ // make lines from edges, because they're easier to deal with
+ ll.clear();
+ for (u32 i=0; i < edges.size(); ++i)
+ {
+ SLineList l;
+ l.addEdge(edges[i]);
+ ll.push_back(l);
+ }
+ // add an extra one for inside edges
+ SLineList innerlines;
+ ll.push_back(innerlines);
+
+ // loop through each edge and make triangles
+ for (u32 i=0; i<ll.size(); ++i)
+ {
+ // loop through each line in the edge
+ for (u32 cl=0; cl<ll[i].lines.size(); ++cl)
+ {
+
+ core::line2df ¤tLine = ll[i].lines[cl];
+ f32 bestScore = -10.0f;
+ s32 bestEdge = -1;
+ s32 bestPoint = -1;
+ // find the best scoring point to join to this line
+ for (u32 k=0; k<ll.size(); ++k)
+ for (u32 j=0; j< ll[k].lines.size(); ++j)
+ {
+ f32 score = 0.0f;
+ core::vector2df point(ll[k].lines[j].start.X,
+ ll[k].lines[j].start.Y);
+ core::line2df line1(point,currentLine.start);
+ core::line2df line2(currentLine.end,point);
+
+ // can't be part of the current line
+ if (point == currentLine.start || point == currentLine.end)
+ continue;
+
+ // must be to the right hand side (triangles are wound clockwise)
+ // unless its part of the inside...
+ f32 side1 = currentLine.getPointOrientation(point);
+ f32 side2 = core::line2df(point,currentLine.start).getPointOrientation(currentLine.end);
+ f32 side3 = core::line2df(currentLine.end,point).getPointOrientation(currentLine.start);
+ if (i<ll.size()-1)
+ if (side1 <= 0 || side2 <= 0 || side3 <=0)
+ continue;
+
+ // can't already have this triangle
+ if (triangles.hasTriangle(currentLine.start,currentLine.end,point))
+ continue;
+
+ // must not cross any other lines or enclose any points
+ bool itCrossed = false;
+ for (u32 v=0; v<ll.size(); ++v)
+ if (ll[v].crossesWith(currentLine, point))
+ {
+ itCrossed = true;
+ break;
+ }
+ if (itCrossed)
+ continue;
+
+
+ // so, we like this triangle, but how much?
+ // is it better than all the others?
+
+ // we prefer points from other edges, unless its on the inside
+ if (k==i && i != ll.size()-1)
+ score = 1;
+ else
+ score = 2;
+
+ // we prefer evenly shaped triangles
+
+ // we prefer triangles with a large area
+
+ // do we like this one more than the others?
+ if (score>bestScore)
+ {
+ bestScore = score;
+ bestEdge = k;
+ bestPoint = j;
+ }
+ }
+ // hopefully we found one
+ if (bestEdge >= 0 && bestPoint >= 0 && bestScore >= 0.0f)
+ {
+ //assert(bestEdge >= 0 && bestPoint >= 0);
+ //assert(bestScore >= 0.0f);
+
+ core::vector2df point(ll[bestEdge].lines[bestPoint].start.X, ll[bestEdge].lines[bestPoint].start.Y);
+
+ // add it to the triangles list
+ triangles.add(currentLine.start, currentLine.end, point);
+
+ // add inner lines to the line buffer, but only if they arent in others
+
+ core::line2df la(point,currentLine.start);
+ core::line2df lb(currentLine.end,point);
+
+ bool found = false;
+ for (u32 lineno=0;lineno<ll.size()-1; ++lineno)
+ if (ll[lineno].hasLine(la))
+ { found=true; break; }
+ if (!found)
+ ll[ll.size()-1].addLine(la);
+
+ for (u32 lineno=0;lineno<ll.size()-1; ++lineno)
+ if (ll[lineno].hasLine(lb))
+ { found=true; break; }
+ if (!found)
+ ll[ll.size()-1].addLine(lb);
+
+ //drawTriangle(currentLine, point);
+
+ }
+
+ }
+ }
+ }
+
+ // finds the edges
+ void makeEdges()
+ {
+
+ // speed it up
+ refreshIsMemberCache();
+
+ // clear the edges
+ edges.clear();
+
+ // loop through each pixel
+ for (u32 i=0; i < pixels.size(); ++i)
+ {
+ core::position2di &p = pixels[i];
+ s32 &x=p.X, &y=p.Y;
+ bool ul = isMember(p.X-1,p.Y-1);
+ bool u = isMember(p.X,p.Y-1);
+ bool ur = isMember(p.X+1,p.Y-1);
+ bool l = isMember(p.X-1,p.Y);
+ bool r = isMember(p.X+1,p.Y);
+ bool bl = isMember(p.X-1,p.Y+1);
+ bool b = isMember(p.X,p.Y+1);
+ bool br = isMember(p.X+1,p.Y+1);
+
+ // walls already added?
+ bool top=u, bottom=b, left=l, right=r;
+
+ if (!(ul | u | ur | l | r | bl | b | br))
+ {
+ // lone square
+ SEdge a;
+ a.positions.push_back( core::position2di(x,y));
+ a.positions.push_back( core::position2di(x+1,y));
+ a.positions.push_back( core::position2di(x+1,y+1));
+ a.positions.push_back( core::position2di(x,y+1));
+ a.positions.push_back( core::position2di(x,y));
+ edges.push_back(a);
+ top=bottom=left=right=true;
+ }
+ else
+ {
+ if (!(ul|u|l) && (b&r) )
+ {
+ // upper outer diagonal "/"
+ addToEdges(x,y+1,x+1,y);
+ top=left=true;
+ } else if ( !(u|ur|r) && (b&l) )
+ {
+ // upper outer diagonal "\"
+ addToEdges(x,y,x+1,y+1);
+ top=right=true;
+ } else if ( !(l|bl|b) && (r&u) )
+ {
+ // lower outer diagonal "\"
+ addToEdges(x+1,y+1,x,y);
+ left=bottom=true;
+ } else if ( !(r|br|b) && (l&u) )
+ {
+ // lower outer diagonal "/"
+ addToEdges(x+1,y,x,y+1);
+ right=bottom=true;
+ }/* else if (!(b) && (l&bl) )
+ {
+ // upper inner diagonal "/"
+ addToEdges(x+1,y+1,x,y+2);
+ //bottom=true;
+ } else if ( !(b) && (r&br) )
+ {
+ // upper inner diagonal "\"
+ addToEdges(x+1,y+2,x,y+1);
+ //bottom=true;
+ } else if ( !(r) && (b&br) )
+ {
+ // lower inner diagonal "\"
+ addToEdges(x+1,y,x+2,y+1);
+ //right=true;
+ } else if ( !(l) && (b&bl) )
+ {
+ // lower inner diagonal "/"
+ addToEdges(x-1,y+1,x,y);
+ //left=true;
+ }*/
+
+ // add flat edges
+ if (!left /*&& !( (u&ul) || (b&bl)) */) addToEdges(x,y+1,x,y);
+ if (!top /*&& !( (l&ul) || (r&ur)) */) addToEdges(x,y,x+1,y);
+ if (!right /*&& !( (u&ur) || (b&br)) */) addToEdges(x+1,y,x+1,y+1);
+ if (!bottom /*&& !( (l&bl) || (r&br)) */) addToEdges(x+1,y+1,x,y+1);
+ } // lone square
+ } // for
+
+ // reduce the number of points in each edge
+ for (u32 i=0; i<edges.size(); ++i)
+ {
+ edges[i].reduce(1);
+
+ // all edges should have at least 3 points
+ assert(edges[i].positions.size() >= 3);
+
+ // all edges should be closed
+ assert(edges[i].positions[0] == edges[i].positions[edges[i].positions.size()-1] );
+ }
+ }
+
+ // adds a line to the edges arrays
+ void addToEdges(s32 x1, s32 y1, s32 x2, s32 y2)
+ {
+ bool found=false;
+ // loop through each edge
+ for (u32 i=0; i<edges.size(); ++i)
+ {
+ // if this line starts at the end of an edge
+ if ( edges[i].positions[edges[i].positions.size()-1] == core::position2di(x1,y1))
+ {
+ // add it to the end
+ edges[i].positions.push_back(core::position2di(x2,y2));
+ found=true;
+ break;
+ }
+ // if the line ends at the start of the edge
+ if ( edges[i].positions[0]== core::position2di(x2,y2))
+ {
+ // add it to the front
+ edges[i].positions.push_front(core::position2di(x1,y1));
+ found=true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ // we make a new edge
+ SEdge n;
+ n.positions.push_back(core::position2di(x1,y1));
+ n.positions.push_back(core::position2di(x2,y2));
+ edges.push_back(n);
+ }
+
+ joinEdges();
+ }
+
+ void joinEdges()
+ {
+ // touching edges are joined
+
+ for (u32 i=0; i < edges.size(); ++i)
+ for (u32 j=0; j < edges.size(); ++j)
+ {
+ if (i != j && edges[j].positions.size() && edges[i].positions.size())
+ {
+ if (edges[j].positions[0] == edges[i].positions[edges[i].positions.size()-1])
+ {
+ for (u32 k=0; k < edges[j].positions.size(); ++k)
+ edges[i].positions.push_back(edges[j].positions[k]);
+ edges[j].positions.clear();
+ }
+ }
+ }
+
+ // remove empty edges
+ for (u32 i=0; i<edges.size(); ++i)
+ if (edges[i].positions.size() == 0)
+ edges.erase(i--);
+ }
+
+ // tells if this x,y position is a member of this group
+ bool isMember(s32 x, s32 y)
+ {
+ //for (u32 i=0; i<pixels.size(); ++i)
+ // if (pixels[i].X == x && pixels[i].Y == y)
+ // return true;
+ if (x>pixelWidth || y>pixelHeight || x<0 || y<0)
+ return false;
+ else
+ return isMemberCache[pixelWidth*y + x];
+ }
+
+ void refreshIsMemberCache()
+ {
+ isMemberCache.clear();
+ pixelWidth=0; pixelHeight=0;
+ for (u32 i=0; i<pixels.size(); ++i)
+ {
+ if (pixels[i].X>pixelWidth) pixelWidth=pixels[i].X;
+ if (pixels[i].Y>pixelHeight) pixelHeight=pixels[i].Y;
+ }
+ pixelWidth+=2; pixelHeight+=2;
+ isMemberCache.set_used(pixelWidth*pixelHeight+1);
+ for (u32 i=0; i<isMemberCache.size(); ++i)
+ isMemberCache[i] = false;
+ for (u32 i=0; i<pixels.size(); ++i)
+ isMemberCache[pixelWidth*pixels[i].Y + pixels[i].X] = true;
+ }
+ };
+
+
+ void drawEdges(IrrlichtDevice *device, u32 t, s32 scale)
+ {
+ const u32 stt = device->getTimer()->getTime();
+ const u32 endt = stt + t;
+
+ while(device->getTimer()->getTime() < endt )
+ {
+ const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f;
+
+ device->run();
+ device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0));
+ for (u32 g=0;g<groups.size(); ++g)
+ for (u32 v=0;v<groups[g].edges.size(); ++v)
+ for (u32 p=1;p<groups[g].edges[v].positions.size(); ++p)
+ {
+ core::position2di st = core::position2di(groups[g].edges[v].positions[p-1].X*scale+50, groups[g].edges[v].positions[p-1].Y*scale+50) ;
+ core::position2di en = core::position2di(groups[g].edges[v].positions[p].X*scale+50, groups[g].edges[v].positions[p].Y*scale+50) ;
+ core::position2di ep = en-st;
+ ep = st + core::position2di((s32)(ep.X*phase), (s32)(ep.Y*phase));
+ device->getVideoDriver()->draw2DLine(st,en);
+ device->getVideoDriver()->draw2DLine(st,ep,video::SColor(255,255,0,0) );
+ }
+ device->getVideoDriver()->endScene();
+ }
+ }
+
+ void drawTriangles(IrrlichtDevice *device, u32 t, s32 scale)
+ {
+ const u32 stt = device->getTimer()->getTime();
+ const u32 endt = stt + t;
+
+ while(device->getTimer()->getTime() < endt )
+ {
+ const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f;
+
+ device->run();
+ device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0));
+ for (u32 g=0;g<groups.size(); ++g)
+ for (u32 v=0;v<groups[g].triangles.indexes.size()*phase; v+=3)
+ {
+ STriangleList &t = groups[g].triangles;
+ core::position2di st((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50);
+ core::position2di en((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50);
+ device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0));
+ st = core::position2di((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50);
+ en = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50);
+ device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,255,0));
+ st = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50);
+ en = core::position2di((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50);
+ device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,0,255));
+ }
+ device->getVideoDriver()->endScene();
+ }
+ }
+
+ void drawTriLines(IrrlichtDevice *device, u32 t, s32 scale)
+ {
+ const u32 endt = device->getTimer()->getTime() + t;
+
+ while(device->getTimer()->getTime() < endt )
+ {
+ device->run();
+ device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0));
+ for (u32 g=0;g<groups.size(); ++g)
+ for (u32 v=0;v<groups[g].ll.size()-1; ++v)
+ for (u32 h=0;h<groups[g].ll[v].lines.size(); ++h)
+ {
+ core::line2df ¤tline = groups[g].ll[v].lines[h];
+ const core::position2di st((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50);
+ const core::position2di en((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50);
+ device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0));
+ }
+
+ device->getVideoDriver()->endScene();
+ }
+ }
+ void drawTri3D(IrrlichtDevice *device, u32 t)
+ {
+ for (u32 g=0;g<groups.size(); ++g)
+ {
+ STriangleList &t = groups[g].triangles;
+ core::array<S3DVertex> verts;
+ verts.clear();
+ for(u32 v=0; v< t.positions.size(); ++v)
+ {
+ verts.push_back(S3DVertex(
+ -t.positions[v].X, -t.positions[v].Y, -100,
+ 0,0,1,SColor(255,255,255,255),0,0));
+ }
+
+ device->getVideoDriver()->drawIndexedTriangleList(verts.pointer(),verts.size(),t.indexes.pointer(), t.indexes.size()/3 );
+ }
+ }
+
+
+ // process all pixels
+ void findGroups()
+ {
+ for (int y=0; y<height; ++y)
+ for (int x=0; x<width; ++x)
+ processPixel(x,y);
+
+ }
+
+ // remove groups with no pixels
+ void removeGroups()
+ {
+ for (u32 i=0; i<groups.size(); ++i)
+ if (groups[i].pixels.size() == 0)
+ groups.erase(i--);
+
+ /*for (s32 y=0; y <height; ++y)
+ {
+ printf("\n");
+ for (s32 x=0; x <width; ++x)
+ {
+ s32 i;
+ for (i=0; i<groups.size(); ++i)
+ {
+ bool k = groups[i].isMember(x,y);
+ if (k)
+ break;
+ }
+ printf("%d",i);
+ }
+ }*/
+
+
+ }
+
+ // adds a pixel to its area, merging touching areas
+ void processPixel(s32 x, s32 y)
+ {
+ // solid?
+ if (getPixel(x,y))
+ {
+ s32 g=0, grp=0;
+
+ bool found=false;
+ if (x>0) // look one behind
+ {
+ grp = getRef(x-1,y);
+ if (grp) found=true;
+ }
+ if (y>0) // look above
+ {
+ if (x>0) // top left
+ {
+ g = getRef(x-1,y-1);
+
+ if (g)
+ {
+ if (found)
+ {
+ mergeGroups(grp, g);
+ }
+ else
+ {
+ grp = g;
+ found = true;
+ }
+ }
+ }
+
+ if (x<width-1) // top right
+ {
+ g = getRef(x+1,y-1);
+
+ if (g)
+ {
+ if (found)
+ {
+ mergeGroups(grp, g);
+ }
+ else
+ {
+ grp = g;
+ found = true;
+ }
+ }
+ }
+
+ // top
+
+ g = getRef(x,y-1);
+
+ if (g)
+ {
+ if (found)
+ {
+ mergeGroups(grp, g);
+ }
+ else
+ {
+ grp = g;
+ found = true;
+ }
+ }
+
+ }
+
+ // didn't find a group for this pixel, so we add one
+ if (!found)
+ {
+ SPixelGroup p(Device);
+ p.pixels.push_back(core::position2di(x,y));
+ groups.push_back(p);
+ groupRefs.push_back(groups.size());
+ grp=groups.size();
+ }
+ else
+ {
+ groups[groupRefs[grp-1]-1].pixels.push_back(core::position2di(x,y));
+ }
+ setRef(x,y,groupRefs[grp-1]);
+ }
+ }
+
+ bool& getPixel(s32 x, s32 y) { return mem[y*width +x]; }
+ s32& getRef(s32 x, s32 y) { return refbuffer[y*width +x]; }
+ void setRef(s32 x, s32 y, s32 g) { refbuffer[y*width +x] = g; }
+
+ void mergeGroups(s32 g1, s32 g2)
+ {
+ if (g1==g2)
+ return;
+ // joins two groups together
+ for (u32 i=0; i<groups[g2-1].pixels.size(); ++i)
+ groups[g1-1].pixels.push_back(groups[g2-1].pixels[i]);
+ groups[g2-1].pixels.clear();
+ groupRefs[g2-1] = g1;
+ }
+
+ s32 width, height;
+ core::array<SPixelGroup> groups;
+ core::array<s32> groupRefs;
+ core::array<s32> refbuffer;
+ bool *mem;
+ IrrlichtDevice *Device;
+};
+
+// creates a simple vector font from a bitmap from the font tool
+class CVectorFontTool
+{
+public:
+ CVectorFontTool(CFontTool *fonttool) :
+ triangulator(0), FontTool(fonttool),
+ letterHeight(0), letterWidth(0), triangles()
+ {
+ core::map<wchar_t, u32>::Iterator it = FontTool->CharMap.getIterator();
+
+ while(!it.atEnd())
+ {
+ CFontTool::SFontArea &fa = FontTool->Areas[(*it).getValue()];
+
+ if (fa.rectangle.getWidth() > letterWidth)
+ letterWidth = fa.rectangle.getWidth();
+ if (fa.rectangle.getHeight() > letterHeight)
+ letterHeight = fa.rectangle.getHeight();
+
+ it++;
+ }
+
+ // number of verts is one more than number of pixels because it's a grid of squares
+ letterWidth++;
+ letterHeight++;
+
+ // create image memory
+ imagedata.set_used(letterWidth*letterHeight);
+
+ // create vertex list, set position etc
+ verts.set_used(letterWidth*letterHeight);
+ for (s32 y=0; y<letterHeight; ++y)
+ {
+ for (s32 x=0; x<letterWidth; ++x)
+ {
+ S3DVertex &v = getVert(x,y);
+ v.Pos = core::vector3df((f32)x,(f32)y,0.0f);
+ v.TCoords.X = (f32)letterWidth / (f32)x;
+ v.TCoords.Y = (f32)letterHeight / (f32)y;
+ v.Normal = core::vector3df(0,0,-1);
+ v.Color = SColor(255,255,255,255);
+ }
+ }
+ // clear index list
+ inds.clear();
+
+ // create each char in the font...
+ it = FontTool->CharMap.getIterator();
+ while(!it.atEnd())
+ {
+ addChar((*it).getKey());
+ it++;
+ }
+ }
+
+ ~CVectorFontTool()
+ {
+ if (triangulator)
+ delete triangulator;
+ }
+
+ void addChar(wchar_t thischar)
+ {
+ const s32 area = FontTool->CharMap[thischar];
+ const CFontTool::SFontArea &fa = FontTool->Areas[area];
+
+ const s32 img = fa.sourceimage;
+ const core::rect<s32>& r = fa.rectangle;
+
+ // init image memory
+ IImage *image = FontTool->currentImages[img];
+ for (u32 i=0; i < imagedata.size(); ++i)
+ imagedata[i] = false;
+ for (s32 y=r.UpperLeftCorner.Y; y < r.LowerRightCorner.Y; ++y)
+ {
+ for (s32 x=r.UpperLeftCorner.X; x < r.LowerRightCorner.X ; ++x)
+ if (image->getPixel(x,y).getBlue() > 0)
+ {
+ imagedata[letterWidth*(y-r.UpperLeftCorner.Y) +(x-r.UpperLeftCorner.X)] = true;
+ }
+ }
+
+ // get shape areas
+ triangulator = new CGroupFinder(imagedata.pointer(), letterWidth, letterHeight, FontTool->Device );
+
+ wprintf(L"Created character '%c' in texture %d\n", thischar, img );
+
+ //floodfill->drawEdges(FontTool->Device, 500, 3);
+ //floodfill->drawTriangles(FontTool->Device, 500,30);
+ //floodfill->drawTriLines(FontTool->Device, 200,3);
+
+ /*
+ if (area==32 && map == 0)
+ {
+ scene::ISceneManager *smgr = FontTool->Device->getSceneManager();
+ smgr->addCameraSceneNodeFPS();
+ while(FontTool->Device->run())
+ {
+ //floodfill->drawEdges(FontTool->Device, 100, 30);
+ FontTool->Device->getVideoDriver()->beginScene(true, true, video::SColor(0,200,200,200));
+ smgr->drawAll();
+ floodfill->drawTri3D(FontTool->Device, 100);
+ FontTool->Device->getVideoDriver()->endScene();
+ }
+ }*/
+
+ u32 lastind = triangles.indexes.size();
+
+ // loop through each shape and add it to the current character...
+ for (u32 i=0; i < triangulator->groups.size(); ++i)
+ triangles += triangulator->groups[i].triangles;
+
+ // add character details
+ charstarts.push_back(lastind);
+ charlengths.push_back(triangles.indexes.size() - lastind);
+ chars.push_back(thischar);
+ }
+
+ bool saveVectorFont(const c8 *filename, const c8 *formatname)
+ {
+ IrrlichtDevice *Device = FontTool->Device;
+
+ if (triangles.indexes.size() == 0)
+ {
+ Device->getLogger()->log("No vector data to write, aborting.");
+ return false;
+ }
+
+ core::stringc fn = filename;
+
+ if (core::stringc(formatname) == core::stringc("xml"))
+ {
+ fn += ".xml";
+ io::IXMLWriter *writer = FontTool->Device->getFileSystem()->createXMLWriter(fn.c_str());
+
+ // header and line breaks
+ writer->writeXMLHeader();
+ writer->writeLineBreak();
+
+ // write info header
+ writer->writeElement(L"font", false, L"type", L"vector");
+ writer->writeLineBreak();
+ writer->writeLineBreak();
+
+ // write each letter
+
+ for (u32 n=0; n<chars.size(); ++n)
+ {
+ u32 i = FontTool->CharMap[chars[n]];
+ CFontTool::SFontArea &fa = FontTool->Areas[i];
+ wchar_t c[2];
+ c[0] = chars[n];
+ c[1] = L'\0';
+ core::stringw area, under, over;
+ area = core::stringw(fa.rectangle.LowerRightCorner.X-
+ fa.rectangle.UpperLeftCorner.X);
+ area += L", ";
+ area += fa.rectangle.LowerRightCorner.Y-
+ fa.rectangle.UpperLeftCorner.Y;
+
+
+ core::array<core::stringw> names;
+ core::array<core::stringw> values;
+ names.clear();
+ values.clear();
+ // char
+ names.push_back(core::stringw(L"c"));
+ values.push_back(core::stringw(c));
+
+ // width+height
+ names.push_back(core::stringw(L"wh"));
+ values.push_back(area);
+
+ // start
+ names.push_back(core::stringw(L"st"));
+ values.push_back(core::stringw(charstarts[n]));
+ // length
+ names.push_back(core::stringw(L"len"));
+ values.push_back(core::stringw(charlengths[n]));
+
+ if (fa.underhang != 0)
+ {
+ under = core::stringw(fa.underhang);
+ names.push_back(core::stringw(L"u"));
+ values.push_back(under);
+ }
+ if (fa.overhang != 0)
+ {
+ over = core::stringw(fa.overhang);
+ names.push_back(core::stringw(L"o"));
+ values.push_back(over);
+ }
+ writer->writeElement(L"c", true, names, values);
+
+ writer->writeLineBreak();
+ }
+
+ // write vertex data
+ core::stringw data, count;
+ data = L"";
+ count = core::stringw(triangles.positions.size());
+ for (u32 i=0; i<triangles.positions.size(); ++i)
+ {
+ if (i!=0)
+ data += L", ";
+ data += (s32)triangles.positions[i].X;
+ data += L",";
+ data += (s32)triangles.positions[i].Y;
+ }
+ writer->writeElement(L"Vertices", true, L"count", count.c_str(), L"data", data.c_str());
+ writer->writeLineBreak();
+
+ // write index list
+ data = L"";
+ count = core::stringw(triangles.indexes.size());
+ for (u32 i=0; i<triangles.indexes.size(); i+=3)
+ {
+ if (i!=0)
+ data += L", ";
+ data += triangles.indexes[i+0];
+ data += L",";
+ data += triangles.indexes[i+1],
+ data += L",";
+ data += triangles.indexes[i+2];
+ }
+
+ writer->writeElement(L"Indices", true, L"count", count.c_str(), L"data", data.c_str());
+ writer->writeLineBreak();
+
+ writer->writeClosingTag(L"font");
+
+ writer->drop();
+
+ Device->getLogger()->log("Font saved.");
+ return true;
+
+ }
+ else if (core::stringc(formatname) == core::stringc("bin"))
+ {
+ FontTool->Device->getLogger()->log("binary fonts not supported yet, sorry");
+ return false;
+ }
+ else
+ {
+ FontTool->Device->getLogger()->log("unsupported file format, unable to save vector font");
+ return false;
+ }
+ }
+
+ S3DVertex& getVert(s32 x, s32 y) { return verts[letterWidth*y +x]; }
+
+ core::array<S3DVertex> verts;
+ core::array<u16> inds;
+ core::array<bool> imagedata;
+
+ core::array<s32> charstarts; // start position of each char
+ core::array<s32> charlengths; // index count
+ core::array<wchar_t> chars; // letters
+
+ CGroupFinder* triangulator;
+ CFontTool* FontTool;
+
+ s32 letterHeight;
+ s32 letterWidth;
+
+ STriangleList triangles;
+};
+
+#endif // __VECTOR_FONT_TOOL_INCLUDED__
+
diff --git a/tools/IrrFontTool/newFontTool/Makefile b/tools/IrrFontTool/newFontTool/Makefile new file mode 100644 index 0000000..cce9145 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/Makefile @@ -0,0 +1,38 @@ +# Makefile for Irrlicht Examples
+# It's usually sufficient to change just the target name and source file list
+# and be sure that CXX is set to a valid compiler
+Target = FontTool
+Sources = CFontTool.cpp main.cpp
+
+# general compiler settings
+CPPFLAGS = -I../../../include -I/usr/X11R6/include -I/usr/include/freetype2/
+CXXFLAGS = -O3 -ffast-math
+#CXXFLAGS = -g -Wall
+
+#default target is Linux
+all: all_linux
+
+ifeq ($(HOSTTYPE), x86_64)
+LIBSELECT=64
+endif
+
+# target specific settings
+all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXft -lfontconfig
+all_linux clean_linux: SYSTEM=Linux
+all_win32: LDFLAGS = -L../../../lib/Win32-gcc -lIrrlicht -lgdi32 -lopengl32 -lglu32 -lm
+all_win32 clean_win32: SYSTEM=Win32-gcc
+all_win32 clean_win32: SUF=.exe
+# name of the binary - only valid for targets which set SYSTEM
+DESTPATH = ../../../bin/$(SYSTEM)/$(Target)$(SUF)
+
+all_linux all_win32:
+ $(warning Building...)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
+
+clean: clean_linux clean_win32
+ $(warning Cleaning...)
+
+clean_linux clean_win32:
+ @$(RM) $(DESTPATH)
+
+.PHONY: all all_win32 clean clean_linux clean_win32
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln b/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln new file mode 100644 index 0000000..1e24460 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v8.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj b/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj new file mode 100644 index 0000000..fcb71a1 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Font Tool"
+ ProjectGUID="{853A396E-C031-4C26-A716-5B4E176BE11D}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib"
+ OutputFile="../../../bin/Win32-visualstudio/FontTool.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/TestProject.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ WholeProgramOptimization="true"
+ AdditionalIncludeDirectories="..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="../../bin/Win32-visualstudio/FontTool.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\CFontTool.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CFontTool.h"
+ >
+ </File>
+ <File
+ RelativePath=".\CVectorFontTool.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
+
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln b/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln new file mode 100644 index 0000000..be110b8 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v9.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32
+ {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj b/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj new file mode 100644 index 0000000..4fa1e4b --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="Font Tool"
+ ProjectGUID="{4D53E40F-37E3-42B1-8848-F4C6F8313A17}"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib"
+ OutputFile="../../../bin/Win32-visualstudio/FontTool.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../lib/Win32-visualstudio"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/TestProject.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ WholeProgramOptimization="false"
+ AdditionalIncludeDirectories="../../../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib"
+ OutputFile="../../../bin/Win32-visualstudio/FontTool.exe"
+ LinkIncremental="0"
+ AdditionalLibraryDirectories="../../../lib/Win32-visualstudio"
+ GenerateDebugInformation="false"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ LinkTimeCodeGeneration="0"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\CFontTool.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CFontTool.h"
+ >
+ </File>
+ <File
+ RelativePath=".\CVectorFontTool.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln b/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln new file mode 100644 index 0000000..48651a8 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc10.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj b/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj new file mode 100644 index 0000000..d031dec --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>FontTool</ProjectName>
+ <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="CFontTool.cpp" />
+ <ClCompile Include="main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="CFontTool.h" />
+ <ClInclude Include="CVectorFontTool.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht10.0.vcxproj">
+ <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln b/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln new file mode 100644 index 0000000..05b60ad --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc11.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32
+ {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj b/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj new file mode 100644 index 0000000..dc2702b --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>FontTool</ProjectName>
+ <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="CFontTool.cpp" />
+ <ClCompile Include="main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="CFontTool.h" />
+ <ClInclude Include="CVectorFontTool.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht11.0.vcxproj">
+ <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/tools/IrrFontTool/newFontTool/irrFontTool_vc12.vcxproj b/tools/IrrFontTool/newFontTool/irrFontTool_vc12.vcxproj new file mode 100644 index 0000000..e94d5d8 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/irrFontTool_vc12.vcxproj @@ -0,0 +1,207 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>FontTool</ProjectName>
+ <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <PlatformToolset>Windows7.1SDK</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions>
+ <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile>
+ <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <LinkTimeCodeGeneration>
+ </LinkTimeCodeGeneration>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="CFontTool.cpp" />
+ <ClCompile Include="main.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="CFontTool.h" />
+ <ClInclude Include="CVectorFontTool.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht10.0.vcxproj">
+ <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/tools/IrrFontTool/newFontTool/main.cpp b/tools/IrrFontTool/newFontTool/main.cpp new file mode 100644 index 0000000..ebaa0e2 --- /dev/null +++ b/tools/IrrFontTool/newFontTool/main.cpp @@ -0,0 +1,493 @@ +/*
+ Tool for creating Irrlicht bitmap+vector fonts,
+ started by Gaz Davidson in December 2006
+
+ Due to my laziness and Microsoft's unintuitive API, surrogate pairs and
+ nonspacing diacritical marks are not supported!
+
+ Linux bitmap font support added by Neil Burlock Oct 2008
+ Note: Xft/Freetype2 is used to render the fonts under X11. Anti-aliasing
+ is controlled by the system and cannot be overriden by an application,
+ so fonts that are rendered will be aliased or anti-aliased depending
+ on the system that they are created on.
+
+*/
+
+
+#include <irrlicht.h>
+#include <iostream>
+
+#include "CFontTool.h"
+#include "CVectorFontTool.h"
+#include "ITexture.h"
+
+using namespace irr;
+using namespace gui;
+
+#pragma comment(lib, "Irrlicht.lib")
+
+const s32 texturesizes[] = {128, 256, 512, 1024, 2048, 4096, 0};
+
+const wchar_t *fileformats[] = { L"bmp", L"ppm", 0 }; // bitmap font formats
+const wchar_t *alphafileformats[] = { L"png", L"tga", 0 }; // bitmap font formats which support alpha channels
+const wchar_t *vectorfileformats[] = { L"xml", L"bin", 0 }; // file formats for vector fonts
+
+const wchar_t *warntext = L"Legal Notice\n"
+ L"------------\n\n"
+ L"When making bitmap and vector fonts, you should consider the potential legal "
+ L"issues with redistributing the fonts with your software; this tool basically "
+ L"copies font data and some authors might not like this!\n"
+ L"If you purchased fonts or they came with an application or your OS, you'll have"
+ L"to check the license to see what restrictions are placed on making derivative works.\n\n"
+ L"PD and the OFL\n"
+ L"--------------\n\n"
+ L"You'll find lots of fonts on the web listed as Public Domain, you can do what you like "
+ L"with these.\n"
+ L"Many fonts are released under the Open Font License, which is a 'viral' open source "
+ L"license like the GPL. It's worth reading the license here: http://scripts.sil.org/OFL\n"
+ L"The most important restrictions are- you must include the original font's license, you "
+ L"can't stop your users from using or distributing the font, the font must have a "
+ L"different name the original.\n\n"
+ L"Some free fonts can be found here- www.openfontlibrary.org\n"
+ L"http://savannah.nongnu.org/projects/freefont/";
+
+const wchar_t *helptext = L"This tool creates bitmap fonts for the Irrlicht Engine\n\n"
+
+ L"First select a character encoding from the list, then choose the font, "
+ L"size, and whether you'd like bold, italic, antialiasing and an alpha channel. "
+ L"In Windows, antialiasing will be ignored for small fonts\n\n"
+
+ L"Then select a texture width and height. If the output exceeds this then more than "
+ L"one image will be created. You can use the scrollbar at the top of the screen to "
+ L"preview them. Most modern graphics cards will support up to 2048x2048, "
+ L"keep in mind that more images means worse performance when drawing text!\n\n"
+
+ L"If you want a vector font rather than a bitmap font, check the vector box. "
+ L"Vector fonts are stored in system memory while bitmap fonts are in video ram\n\n"
+
+ L"Click create to preview your font, this may take lots of time and memory "
+ L"when making a font with a lot of characters, please be patient!\n\n"
+
+ L"Now you're ready to give your font a name, select a format and click save.\n\n"
+ L"To load your font in Irrlicht, simply use env->getFont(\"Myfont.xml\");\n\n"
+
+ L"That's all, have fun :-)";
+
+#ifdef _IRR_WINDOWS_
+ const wchar_t *completeText = L"Font created";
+#else
+ const wchar_t *completeText = L"Font created\n\n"
+ L"Please note that anti-aliasing under X11 is controlled by the system "
+ L"configuration, so if your system is set to use anti-aliasing, then so "
+ L"will any fonts you create with FontTool";
+#endif
+
+enum MYGUI
+{
+ MYGUI_CHARSET = 100,
+ MYGUI_FONTNAME,
+ MYGUI_SIZE,
+ MYGUI_TEXWIDTH,
+ MYGUI_TEXHEIGHT,
+ MYGUI_BOLD,
+ MYGUI_ITALIC,
+ MYGUI_ANTIALIAS,
+ MYGUI_ALPHA,
+ MYGUI_VECTOR,
+ MYGUI_FILENAME,
+ MYGUI_FORMAT,
+ MYGUI_CREATE,
+ MYGUI_SAVE,
+ MYGUI_IMAGE,
+ MYGUI_CURRENTIMAGE,
+ MYGUI_HELPBUTTON
+};
+
+
+// event reciever
+class MyEventReceiver : public IEventReceiver
+{
+public:
+
+ MyEventReceiver(IrrlichtDevice* device, CFontTool*& fonttool, CVectorFontTool* &vectool) :
+ Device(device), FontTool(fonttool), VecTool(vectool)
+ {
+ device->setEventReceiver(this);
+ }
+
+ virtual bool OnEvent(const SEvent &event)
+ {
+ if (event.EventType == EET_GUI_EVENT)
+ {
+ s32 id = event.GUIEvent.Caller->getID();
+ IGUIEnvironment* env = Device->getGUIEnvironment();
+
+ switch(event.GUIEvent.EventType)
+ {
+ case EGET_SCROLL_BAR_CHANGED:
+ if (id == MYGUI_CURRENTIMAGE)
+ {
+ IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true);
+ s32 i = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
+ img->setImage(FontTool->currentTextures[i]);
+
+ return true;
+ }
+ break;
+ case EGET_COMBO_BOX_CHANGED:
+ if (id == MYGUI_CHARSET)
+ {
+ IGUIComboBox* cbo = (IGUIComboBox*)event.GUIEvent.Caller;
+ FontTool->selectCharSet(cbo->getSelected());
+ // rebuild font list
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true);
+ cbo->clear();
+ for (u32 i=0; i < FontTool->FontNames.size(); ++i)
+ cbo->addItem(FontTool->FontNames[i].c_str());
+ return true;
+ }
+ break;
+ case EGET_CHECKBOX_CHANGED:
+ if (id == MYGUI_VECTOR)
+ {
+ IGUICheckBox* chk = (IGUICheckBox*)event.GUIEvent.Caller;
+
+ IGUIComboBox *cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true);
+ cbo->clear();
+
+ if (chk->isChecked() && VecTool)
+ {
+ // vector formats
+ for (s32 i=0; fileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(vectorfileformats[i]).c_str());
+
+ }
+ else
+ {
+
+ // bitmap formats
+ if (!FontTool->UseAlphaChannel)
+ {
+ // add non-alpha formats
+ for (s32 i=0; fileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(fileformats[i]).c_str());
+ }
+ // add formats which support alpha
+ for (s32 i=0; alphafileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(alphafileformats[i]).c_str());
+ }
+
+ }
+ break;
+
+ case EGET_BUTTON_CLICKED:
+
+ if (id == MYGUI_CREATE)
+ {
+ // create the font with the params
+ IGUIComboBox* cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_CHARSET, true);
+ int charset = cbo->getSelected();
+
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true);
+ int fontname = cbo->getSelected();
+
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_SIZE,true);
+ int fontsize = cbo->getSelected();
+
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXWIDTH,true);
+ int texwidth = cbo->getSelected();
+
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXHEIGHT,true);
+ int texheight = cbo->getSelected();
+
+ IGUICheckBox* chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_BOLD,true);
+ bool bold = chk->isChecked();
+ chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ITALIC,true);
+ bool italic = chk->isChecked();
+
+ chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ALPHA,true);
+ bool alpha = chk->isChecked();
+
+ chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ANTIALIAS,true);
+ bool aa = chk->isChecked();
+
+ // vector fonts disabled
+ //chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true);
+ bool vec = false;//chk->isChecked();
+
+ FontTool->makeBitmapFont(fontname, charset, FontTool->FontSizes[fontsize], texturesizes[texwidth], texturesizes[texheight], bold, italic, aa, alpha);
+
+ IGUIScrollBar* scrl = (IGUIScrollBar*)env->getRootGUIElement()->getElementFromId(MYGUI_CURRENTIMAGE,true);
+ scrl->setMax(FontTool->currentTextures.size() == 0 ? 0 : FontTool->currentTextures.size()-1);
+
+ if (FontTool->currentTextures.size() > 0)
+ {
+ IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true);
+ img->setImage(FontTool->currentTextures[0]);
+ scrl->setPos(0);
+ }
+
+ // make sure users pick a file format that supports alpha channel
+ cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true);
+ cbo->clear();
+
+ if (vec)
+ {
+ // add vector formats
+ for (s32 i=0; fileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(vectorfileformats[i]).c_str());
+ }
+ else
+ {
+ if (!alpha)
+ {
+ // add non-alpha formats
+ for (s32 i=0; fileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(fileformats[i]).c_str());
+ }
+ // add formats which support alpha
+ for (s32 i=0; alphafileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(alphafileformats[i]).c_str());
+ }
+ if (VecTool)
+ {
+ delete VecTool;
+ VecTool = 0;
+ }
+ if (vec)
+ {
+ VecTool = new CVectorFontTool(FontTool);
+ }
+
+ /* Message box letting the user know the process is complete */
+ env->addMessageBox(L"Create", completeText);
+
+ return true;
+ }
+
+ if (id == MYGUI_SAVE)
+ {
+ IGUIEditBox *edt = (IGUIEditBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FILENAME,true);
+ core::stringc name = edt->getText();
+
+ IGUIComboBox *fmt = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true);
+ core::stringc format = fmt->getItem(fmt->getSelected());
+
+ // vector fonts disabled
+ IGUICheckBox *chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true);
+ bool vec = false; // chk->isChecked();
+
+ if (vec && VecTool)
+ VecTool->saveVectorFont(name.c_str(), format.c_str());
+ else
+ FontTool->saveBitmapFont(name.c_str(), format.c_str());
+
+ return true;
+ }
+
+ if (id == MYGUI_HELPBUTTON)
+ {
+ env->addMessageBox(L"Irrlicht Unicode Font Tool", helptext);
+ return true;
+ }
+
+ break;
+ }
+ }
+
+ return false;
+ }
+
+ IrrlichtDevice* Device;
+ CFontTool* FontTool;
+ CVectorFontTool* VecTool;
+
+};
+
+void createGUI(IrrlichtDevice* device, CFontTool* fc)
+{
+ gui::IGUIEnvironment *env = device->getGUIEnvironment();
+
+ // change transparency of skin
+ for (s32 i=0; i<gui::EGDC_COUNT ; ++i)
+ {
+ video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
+ col.setAlpha(255);
+ env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col);
+ }
+
+ IGUIWindow *win = env->addWindow( core::rect<s32>(10,10,200,500), false, L"Font Creator");
+ win->getCloseButton()->setVisible(false);
+
+ s32 xs=10,xp=xs, yp=30, h=20;
+
+ env->addStaticText(L"Charset", core::rect<s32>(xp,yp,50,yp+h),false,false, win);
+
+ xp+=60;
+
+ // charset combo
+ gui::IGUIComboBox* cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_CHARSET);
+ for (u32 i=0; i < fc->CharSets.size(); ++i)
+ cbo->addItem(fc->CharSets[i].c_str());
+
+ yp += (s32)(h*1.5f);
+ xp = xs;
+
+ env->addStaticText(L"Font", core::rect<s32>(xp,yp,50,yp+h),false,false, win);
+
+ xp+=60;
+
+ // font name combo
+ cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_FONTNAME);
+ for (u32 i=0; i < fc->FontNames.size(); ++i)
+ cbo->addItem(fc->FontNames[i].c_str());
+
+ yp += (s32)(h*1.5f);
+ xp = xs;
+
+ env->addStaticText(L"Size", core::rect<s32>(xp,yp,50,yp+h),false,false, win);
+
+ xp += 60;
+
+ // font size combo
+ cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SIZE);
+ for (s32 i=0; fc->FontSizes[i] != 0; ++i)
+ cbo->addItem( ((core::stringw(fc->FontSizes[i])) + L"px").c_str());
+
+ xp = xs;
+ yp += (s32)(h*1.5f);
+
+ // bold checkbox
+ env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_BOLD, L"Bold");
+
+ xp += 45;
+
+ // italic checkbox
+ env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ITALIC, L"Italic");
+
+ xp += 45;
+
+ // AA checkbox
+ env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ANTIALIAS, L"AA");
+
+ xp +=40;
+
+ // Alpha checkbox
+ env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ALPHA, L"Alpha");
+
+ xp = xs;
+ yp += (s32)(h*1.5f);
+
+ /*
+ // vector fonts can't be loaded yet
+ env->addCheckBox(false, core::rect<s32>(xp,yp,xp+200,yp+h),win, MYGUI_VECTOR, L"Vector Font");
+ */
+
+ yp += (s32)(h*1.5f);
+
+ env->addStaticText(L"Max Width:", core::rect<s32>(xp,yp,50,yp+h),false,false, win);
+
+ xp += 60;
+
+ // texture widths
+ cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXWIDTH);
+ for (s32 i=0; texturesizes[i] != 0; ++i)
+ cbo->addItem( ((core::stringw(texturesizes[i])) + L" wide").c_str());
+
+ xp=xs;
+ yp += (s32)(h*1.5f);
+
+ env->addStaticText(L"Max Height:", core::rect<s32>(xp,yp,60,yp+h),false,false, win);
+
+ xp += 60;
+
+ // texture height
+ cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXHEIGHT);
+ for (s32 i=0; texturesizes[i] != 0; ++i)
+ cbo->addItem( ((core::stringw(texturesizes[i])) + L" tall").c_str());
+
+ // file name
+ xp = xs;
+ yp += (s32)(h*1.5f);
+ env->addStaticText(L"Filename", core::rect<s32>(xp,yp,60,yp+h),false,false, win);
+ xp += 60;
+ env->addEditBox(L"myfont",core::rect<s32>(xp,yp,xp+70,yp+h), true, win, MYGUI_FILENAME);
+
+ // file format
+ xp = xs;
+ yp += (s32)(h*1.5f);
+ env->addStaticText(L"File Format", core::rect<s32>(xp,yp,60,yp+h),false,false, win);
+ xp += 60;
+
+ cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_FORMAT);
+ for (s32 i=0; fileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(fileformats[i]).c_str());
+ for (s32 i=0; alphafileformats[i] != 0; ++i)
+ cbo->addItem( core::stringw(alphafileformats[i]).c_str());
+
+ xp = xs;
+ yp += h*2;
+
+ // create button
+ env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_CREATE, L"Create");
+
+ xp += 60;
+
+ // save button
+ env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SAVE, L"Save");
+
+ xp += 60;
+
+ // help button
+ env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_HELPBUTTON, L"Help");
+
+ // font image
+ gui::IGUIImage *img = env->addImage(0, core::position2d<s32>(0,0), true,0, MYGUI_IMAGE);
+ img->setRelativePosition(core::rect<s32>(0,20,800,600));
+
+ // font scrollbar
+ IGUIScrollBar *scrl= env->addScrollBar(true,core::rect<s32>(0,0,800,20),0, MYGUI_CURRENTIMAGE);
+ scrl->setMax(0);
+ scrl->setSmallStep(1);
+
+ yp += h*3;
+
+ env->getRootGUIElement()->bringToFront(win);
+ win->setRelativePosition( core::rect<s32>(10,10,200,yp));
+}
+
+int main()
+{
+ IrrlichtDevice* device =createDevice(video::EDT_OPENGL, core::dimension2du(800, 600));
+ video::IVideoDriver* driver = device->getVideoDriver();
+ scene::ISceneManager* smgr = device->getSceneManager();
+ gui::IGUIEnvironment *env = device->getGUIEnvironment();
+
+ // create font tool
+ CFontTool *fc = new CFontTool(device);
+ CVectorFontTool *vc = 0;
+
+ IEventReceiver *events = new MyEventReceiver(device,fc,vc);
+
+ createGUI(device, fc);
+
+ while(device->run())
+ {
+ if (device->isWindowActive())
+ {
+
+ driver->beginScene(true, true, video::SColor(0,200,200,200));
+ smgr->drawAll();
+ env->drawAll();
+ driver->endScene();
+ }
+ }
+
+ // drop the font tool and resources
+ fc->drop();
+
+ device->drop();
+
+ return 0;
+}
+
|
