<NME> GDIFont.cpp
<BEF> #include <Font.h>
#include <windows.h>
#include <algorithm>
#ifdef max
#undef max
#undef min
#endif

namespace nme
{

static HDC sgFontDC = 0;
static HBITMAP sgDIB = 0;
static HBITMAP sgOldDIB = 0;
static ARGB *sgDIBBits = 0;
static int sgDIB_W = 0;
static int sgDIB_H = 0;
static unsigned char sGammaLUT[256];
static bool sGammaLUTInit = false;

class GDIFont : public FontFace
{
public:
   bool bold;
   bool italic;

   GDIFont(HFONT inFont, int inHeight, bool inBold, bool inItalic) : mFont(inFont), mPixelHeight(inHeight)
   {
      bold = inBold;
      italic = inItalic;
      SelectObject(sgFontDC,mFont);
      GetTextMetrics(sgFontDC,&mMetrics);
   }

   ~GDIFont()
   {
      DeleteObject(mFont);
   }

   virtual bool GetGlyphInfo(int inChar, int &outW, int &outH, int &outAdvance,
                           int &outOx, int &outOy)
   {
      wchar_t ch = inChar;
      SelectObject(sgFontDC,mFont);
      SIZE size;
      GetTextExtentPointW(sgFontDC,  &ch, 1, &size );
      outW = size.cx;
      if (italic)
         outW += ( (size.cy+7)>>3 );
      outH = size.cy;
      outAdvance = size.cx<<6;
      outOx = 0;
      outOy = -mMetrics.tmAscent;
      return true;
   }

   void RenderGlyph(int inChar, const RenderTarget &outTarget)
   {
      if (!sGammaLUTInit)
      {
         double pow_max = 255.0/pow(255,1.9);
         for(int i=0;i<256;i++)
         {
            sGammaLUT[i] = pow(i,1.9)*pow_max + 0.5;
         }
         sGammaLUTInit = true;
      }
      int w = outTarget.mRect.w;
      w = (w+3) & ~3;
      int h = outTarget.mRect.h;
      if (w>sgDIB_W || h>sgDIB_H)
      {
         if (sgDIB)
         {
            SelectObject(sgFontDC,sgOldDIB);
            DeleteObject(sgDIB);
         }
         BITMAPINFO bmi;
         memset(&bmi,0,sizeof(bmi));
         bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
         bmi.bmiHeader.biWidth = w;
         bmi.bmiHeader.biHeight = h;
         bmi.bmiHeader.biPlanes = 1;
         bmi.bmiHeader.biBitCount = 32;
         bmi.bmiHeader.biCompression = BI_RGB;
         sgDIB_W = w;
         sgDIB_H = h;

         sgDIB = CreateDIBSection(sgFontDC,&bmi,DIB_RGB_COLORS, (void **)&sgDIBBits, 0, 0 );
         sgOldDIB = (HBITMAP)SelectObject(sgFontDC,sgDIB);
      }
      memset(sgDIBBits,0,sgDIB_W*sgDIB_H*4);
      wchar_t ch = inChar;
      TextOutW(sgFontDC,0,0,&ch,1);

      for(int y=0;y<outTarget.mRect.h;y++)
      {
         ARGB *src = sgDIBBits + (sgDIB_H - 1 - y)*sgDIB_W;
         uint8  *dest = (uint8 *)outTarget.Row(y + outTarget.mRect.y) + outTarget.mRect.x;
         for(int x=0;x<outTarget.mRect.w;x++)
            *dest++= sGammaLUT[(src++)->g];
      }

   }

   void UpdateMetrics(TextLineMetrics &ioMetrics)
   {
      ioMetrics.ascent = std::max( ioMetrics.ascent, (float)mMetrics.tmAscent);
      ioMetrics.descent = std::max( ioMetrics.descent, (float)mMetrics.tmDescent);
      ioMetrics.height = std::max( ioMetrics.height, (float)mMetrics.tmHeight);
   }

   int Height()
   {
      return mMetrics.tmHeight;
   }

   virtual bool IsNative() { return true; }



   HFONT mFont;
   TEXTMETRIC mMetrics;
   int mPixelHeight;
};

int CALLBACK MyEnumFontFunc(
    const LOGFONTW *lpelfe,
    const TEXTMETRICW *lpntme,
    DWORD FontType,
    LPARAM lParam
)
{
   return 0;
}



FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)
{
   //The height needs to be >=1, 0 causes the font mapper to use the default height
   int height = (int)std::max(( 0.5 + inFormat.size*inScale ), 1.0);
   LOGFONTW desc;
   memset(&desc,0,sizeof(desc));

   desc.lfHeight = -height;
   //desc.lfWidth; 
   //desc.lfEscapement; 
   //desc.lfOrientation; 
   desc.lfWeight = inFormat.bold ? FW_BOLD : FW_NORMAL;
   desc.lfItalic = inFormat.italic;
   desc.lfUnderline = inFormat.underline;
   //desc.lfStrikeOut; 
   desc.lfCharSet = DEFAULT_CHARSET; 
   desc.lfOutPrecision = OUT_RASTER_PRECIS; 
   desc.lfClipPrecision = CLIP_DEFAULT_PRECIS; 
   desc.lfQuality = ANTIALIASED_QUALITY; 
   desc.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; 
   wcsncpy(desc.lfFaceName,inFormat.font(L"times").c_str(),LF_FACESIZE);

   if (!sgFontDC)
   {
      sgFontDC = CreateCompatibleDC(0);
      SetBkColor(sgFontDC, RGB(0,0,0));
      SetTextColor(sgFontDC, RGB(255,255,255));
      SetTextAlign( sgFontDC, TA_TOP );
   }

   // Check to see if it is there....
  int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );
  if (bad)
  {
     return 0;
  }

   HFONT hfont = CreateFontIndirectW( &desc );
   if (!hfont)
     return 0;

   return new GDIFont(hfont,height, inFormat.bold, inFormat.italic);
}

} // end namespace nme

<MSG> Add some more font aliases

<DFF> @@ -158,6 +158,47 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)
    desc.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; 
    wcsncpy(desc.lfFaceName,inFormat.font(L"times").c_str(),LF_FACESIZE);
 
+
+   // Check to see if it is there....
+   for(int pass=0;pass<3;pass++)
+   {
+     // got nothing..
+     if (pass==2)
+       return 0;
+
+     if (pass==1)
+     {
+        WString name = inFormat.font(L"times").c_str();
+        for(int i=0;i<name.size();i++)
+           if (name[i]>='A' && name[i]<='Z')
+              name[i] = name[i] - 'A' + 'a';
+
+        if (name==L"serif" ||
+            name==L"\"serif\"" ||
+            name==L"_serif" ||
+            name==L"times.ttf")
+           wcsncpy(desc.lfFaceName,L"times",LF_FACESIZE);
+        else if (name==L"sans" ||
+                 name==L"\"sans\"" ||
+                 name==L"_sans" ||
+                 name==L"sans-serif" ||
+                 name==L"\"sans-serif\"" ||
+                 name==L"arial.ttf")
+           wcsncpy(desc.lfFaceName,L"arial",LF_FACESIZE);
+        else if (name==L"_monospace" ||
+                 name==L"\"monospace\"" ||
+                 name==L"_typewriter" ||
+                 name==L"courier.ttf")
+           wcsncpy(desc.lfFaceName,L"courier",LF_FACESIZE);
+        else
+           break;
+     }
+
+     int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );
+     if (!bad)
+        break;
+   }
+
    if (!sgFontDC)
    {
       sgFontDC = CreateCompatibleDC(0);
@@ -166,12 +207,6 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)
       SetTextAlign( sgFontDC, TA_TOP );
    }
 
-   // Check to see if it is there....
-  int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );
-  if (bad)
-  {
-     return 0;
-  }
 
    HFONT hfont = CreateFontIndirectW( &desc );
    if (!hfont)

{'commit': 'diff --git a/project/src/common/Font.cpp b/project/src/common/Font.cpp\nindex 34bb0277..255e1dbc 100644\n--- a/project/src/common/Font.cpp\n+++ b/project/src/common/Font.cpp\n@@ -310,6 +310,29 @@ struct FontInfo\n    unsigned int flags;\n };\n \n+const char *RemapFontName(const char *inName)\n+{\n+   if (!strcasecmp(inName,"times.ttf") ||\n+       !strcasecmp(inName,"serif") ||\n+       !strcasecmp(inName,"\\"serif\\"") ||\n+       !strcasecmp(inName,"times"))\n+      return "_serif"; \n+   else if (!strcasecmp(inName,"arial.ttf") ||\n+            !strcasecmp(inName,"arial") ||\n+            !strcasecmp(inName,"\\"sans-serif\\"") ||\n+            !strcasecmp(inName,"sans-serif") )\n+      return "_sans"; \n+   else if (!strcasecmp(inName,"_typewriter") ||\n+            !strcasecmp(inName,"courier.ttf") ||\n+            !strcasecmp(inName,"monospace") ||\n+            !strcasecmp(inName,"\\"monospace\\"") ||\n+            !strcasecmp(inName,"courier"))\n+      return "_monospace"; \n+\n+   return 0;\n+}\n+\n+\n \n typedef std::map<FontInfo, Font *> FontMap;\n FontMap sgFontMap;\n@@ -350,19 +373,10 @@ Font *Font::Create(TextFormat &inFormat,double inScale,bool inNative,bool inInit\n       }\n       else if (pass==2)\n       {\n-         if (!strcasecmp(fontName.c_str(),"times.ttf") ||\n-             !strcasecmp(fontName.c_str(),"times"))\n-            seekName = "_serif"; \n-         else if (!strcasecmp(fontName.c_str(),"arial.ttf") ||\n-                  !strcasecmp(fontName.c_str(),"arial") ||\n-                  !strcasecmp(fontName.c_str(),"sans-serif") )\n-            seekName = "_sans"; \n-         else if (!strcasecmp(fontName.c_str(),"_typewriter") ||\n-                  !strcasecmp(fontName.c_str(),"courier.ttf") ||\n-                  !strcasecmp(fontName.c_str(),"courier"))\n-            seekName = "_monospace"; \n-         else\n+         const char *remappedFont = RemapFontName(fontName.c_str());\n+         if (!remappedFont)\n             break;\n+         seekName = remappedFont;\n       }\n \n       AutoGCRoot *bytes = 0;\n@@ -409,7 +423,10 @@ Font *Font::Create(TextFormat &inFormat,double inScale,bool inNative,bool inInit\n       face = FontFace::CreateNative(inFormat,inScale);\n \n    if (!face)\n+   {\n+      //printf("Missing face : %s\\n", fontName.c_str() );\n        return 0;\n+   }\n \n    font =  new Font(face,info.height,inInitRef);\n    // Store for Ron ...\ndiff --git a/project/src/common/FreeType.cpp b/project/src/common/FreeType.cpp\nindex 6ceaee01..c6ebd756 100644\n--- a/project/src/common/FreeType.cpp\n+++ b/project/src/common/FreeType.cpp\n@@ -618,7 +618,7 @@ FT_Face FindFont(const std::string &inFontName, unsigned int inFlags, AutoGCRoot\n }\n \n \n-\n+extern const char *RemapFontName(const char *inName);\n \n FontFace *FontFace::CreateFreeType(const TextFormat &inFormat,double inScale,AutoGCRoot *inBytes, const std::string &inCombinedName)\n {\n@@ -641,6 +641,13 @@ FontFace *FontFace::CreateFreeType(const TextFormat &inFormat,double inScale,Aut\n    \n    void* pBuffer = 0;\n    face = FindFont(str,flags,inBytes,&pBuffer);\n+   if (!face)\n+   {\n+      const char *alternate = RemapFontName(str.c_str());\n+      if (alternate)\n+         face = FindFont(alternate,flags,inBytes,&pBuffer);\n+   }\n+\n    if (!face)\n       return 0;\n \ndiff --git a/project/src/windows/GDIFont.cpp b/project/src/windows/GDIFont.cpp\nindex 5f1742e0..a6d33168 100644\n--- a/project/src/windows/GDIFont.cpp\n+++ b/project/src/windows/GDIFont.cpp\n@@ -158,6 +158,47 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)\n    desc.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; \n    wcsncpy(desc.lfFaceName,inFormat.font(L"times").c_str(),LF_FACESIZE);\n \n+\n+   // Check to see if it is there....\n+   for(int pass=0;pass<3;pass++)\n+   {\n+     // got nothing..\n+     if (pass==2)\n+       return 0;\n+\n+     if (pass==1)\n+     {\n+        WString name = inFormat.font(L"times").c_str();\n+        for(int i=0;i<name.size();i++)\n+           if (name[i]>=\'A\' && name[i]<=\'Z\')\n+              name[i] = name[i] - \'A\' + \'a\';\n+\n+        if (name==L"serif" ||\n+            name==L"\\"serif\\"" ||\n+            name==L"_serif" ||\n+            name==L"times.ttf")\n+           wcsncpy(desc.lfFaceName,L"times",LF_FACESIZE);\n+        else if (name==L"sans" ||\n+                 name==L"\\"sans\\"" ||\n+                 name==L"_sans" ||\n+                 name==L"sans-serif" ||\n+                 name==L"\\"sans-serif\\"" ||\n+                 name==L"arial.ttf")\n+           wcsncpy(desc.lfFaceName,L"arial",LF_FACESIZE);\n+        else if (name==L"_monospace" ||\n+                 name==L"\\"monospace\\"" ||\n+                 name==L"_typewriter" ||\n+                 name==L"courier.ttf")\n+           wcsncpy(desc.lfFaceName,L"courier",LF_FACESIZE);\n+        else\n+           break;\n+     }\n+\n+     int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );\n+     if (!bad)\n+        break;\n+   }\n+\n    if (!sgFontDC)\n    {\n       sgFontDC = CreateCompatibleDC(0);\n@@ -166,12 +207,6 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)\n       SetTextAlign( sgFontDC, TA_TOP );\n    }\n \n-   // Check to see if it is there....\n-  int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );\n-  if (bad)\n-  {\n-     return 0;\n-  }\n \n    HFONT hfont = CreateFontIndirectW( &desc );\n    if (!hfont)\n', 'commit_subject': 'Add some more font aliases', 'repo_name': 'haxenme/nme', 'committer': {'name': 'Hugh', 'email': 'addcc332247940d36e349261d1b5f2717fc37e0e@gmail.com', 'time_sec': '1473921380', 'tz_offset': '480', 'date': {'seconds': '1473921380'}}, 'commit_tree': 'a2ba2215d2617eae1898c07f685cf7894a362268', 'commit_message': 'Add some more font aliases\n', 'language_name': 'Java', 'license': 'mit', 'hunks': '@@ -158,6 +158,47 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)\n    desc.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; \n    wcsncpy(desc.lfFaceName,inFormat.font(L"times").c_str(),LF_FACESIZE);\n \n+\n+   // Check to see if it is there....\n+   for(int pass=0;pass<3;pass++)\n+   {\n+     // got nothing..\n+     if (pass==2)\n+       return 0;\n+\n+     if (pass==1)\n+     {\n+        WString name = inFormat.font(L"times").c_str();\n+        for(int i=0;i<name.size();i++)\n+           if (name[i]>=\'A\' && name[i]<=\'Z\')\n+              name[i] = name[i] - \'A\' + \'a\';\n+\n+        if (name==L"serif" ||\n+            name==L"\\"serif\\"" ||\n+            name==L"_serif" ||\n+            name==L"times.ttf")\n+           wcsncpy(desc.lfFaceName,L"times",LF_FACESIZE);\n+        else if (name==L"sans" ||\n+                 name==L"\\"sans\\"" ||\n+                 name==L"_sans" ||\n+                 name==L"sans-serif" ||\n+                 name==L"\\"sans-serif\\"" ||\n+                 name==L"arial.ttf")\n+           wcsncpy(desc.lfFaceName,L"arial",LF_FACESIZE);\n+        else if (name==L"_monospace" ||\n+                 name==L"\\"monospace\\"" ||\n+                 name==L"_typewriter" ||\n+                 name==L"courier.ttf")\n+           wcsncpy(desc.lfFaceName,L"courier",LF_FACESIZE);\n+        else\n+           break;\n+     }\n+\n+     int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );\n+     if (!bad)\n+        break;\n+   }\n+\n    if (!sgFontDC)\n    {\n       sgFontDC = CreateCompatibleDC(0);\n@@ -166,12 +207,6 @@ FontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)\n       SetTextAlign( sgFontDC, TA_TOP );\n    }\n \n-   // Check to see if it is there....\n-  int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );\n-  if (bad)\n-  {\n-     return 0;\n-  }\n \n    HFONT hfont = CreateFontIndirectW( &desc );\n    if (!hfont)\n', 'addition_count': 41, 'deletion_count': 6, 'src_file': 'a/project/src/windows/GDIFont.cpp', 'tgt_file': 'b/project/src/windows/GDIFont.cpp', 'file_extension': '.cpp', 'before_file': '#include <Font.h>\n#include <windows.h>\n#include <algorithm>\n#ifdef max\n#undef max\n#undef min\n#endif\n\nnamespace nme\n{\n\nstatic HDC sgFontDC = 0;\nstatic HBITMAP sgDIB = 0;\nstatic HBITMAP sgOldDIB = 0;\nstatic ARGB *sgDIBBits = 0;\nstatic int sgDIB_W = 0;\nstatic int sgDIB_H = 0;\nstatic unsigned char sGammaLUT[256];\nstatic bool sGammaLUTInit = false;\n\nclass GDIFont : public FontFace\n{\npublic:\n   bool bold;\n   bool italic;\n\n   GDIFont(HFONT inFont, int inHeight, bool inBold, bool inItalic) : mFont(inFont), mPixelHeight(inHeight)\n   {\n      bold = inBold;\n      italic = inItalic;\n      SelectObject(sgFontDC,mFont);\n      GetTextMetrics(sgFontDC,&mMetrics);\n   }\n\n   ~GDIFont()\n   {\n      DeleteObject(mFont);\n   }\n\n   virtual bool GetGlyphInfo(int inChar, int &outW, int &outH, int &outAdvance,\n                           int &outOx, int &outOy)\n   {\n      wchar_t ch = inChar;\n      SelectObject(sgFontDC,mFont);\n      SIZE size;\n      GetTextExtentPointW(sgFontDC,  &ch, 1, &size );\n      outW = size.cx;\n      if (italic)\n         outW += ( (size.cy+7)>>3 );\n      outH = size.cy;\n      outAdvance = size.cx<<6;\n      outOx = 0;\n      outOy = -mMetrics.tmAscent;\n      return true;\n   }\n\n   void RenderGlyph(int inChar, const RenderTarget &outTarget)\n   {\n      if (!sGammaLUTInit)\n      {\n         double pow_max = 255.0/pow(255,1.9);\n         for(int i=0;i<256;i++)\n         {\n            sGammaLUT[i] = pow(i,1.9)*pow_max + 0.5;\n         }\n         sGammaLUTInit = true;\n      }\n      int w = outTarget.mRect.w;\n      w = (w+3) & ~3;\n      int h = outTarget.mRect.h;\n      if (w>sgDIB_W || h>sgDIB_H)\n      {\n         if (sgDIB)\n         {\n            SelectObject(sgFontDC,sgOldDIB);\n            DeleteObject(sgDIB);\n         }\n         BITMAPINFO bmi;\n         memset(&bmi,0,sizeof(bmi));\n         bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);\n         bmi.bmiHeader.biWidth = w;\n         bmi.bmiHeader.biHeight = h;\n         bmi.bmiHeader.biPlanes = 1;\n         bmi.bmiHeader.biBitCount = 32;\n         bmi.bmiHeader.biCompression = BI_RGB;\n         sgDIB_W = w;\n         sgDIB_H = h;\n\n         sgDIB = CreateDIBSection(sgFontDC,&bmi,DIB_RGB_COLORS, (void **)&sgDIBBits, 0, 0 );\n         sgOldDIB = (HBITMAP)SelectObject(sgFontDC,sgDIB);\n      }\n      memset(sgDIBBits,0,sgDIB_W*sgDIB_H*4);\n      wchar_t ch = inChar;\n      TextOutW(sgFontDC,0,0,&ch,1);\n\n      for(int y=0;y<outTarget.mRect.h;y++)\n      {\n         ARGB *src = sgDIBBits + (sgDIB_H - 1 - y)*sgDIB_W;\n         uint8  *dest = (uint8 *)outTarget.Row(y + outTarget.mRect.y) + outTarget.mRect.x;\n         for(int x=0;x<outTarget.mRect.w;x++)\n            *dest++= sGammaLUT[(src++)->g];\n      }\n\n   }\n\n   void UpdateMetrics(TextLineMetrics &ioMetrics)\n   {\n      ioMetrics.ascent = std::max( ioMetrics.ascent, (float)mMetrics.tmAscent);\n      ioMetrics.descent = std::max( ioMetrics.descent, (float)mMetrics.tmDescent);\n      ioMetrics.height = std::max( ioMetrics.height, (float)mMetrics.tmHeight);\n   }\n\n   int Height()\n   {\n      return mMetrics.tmHeight;\n   }\n\n   virtual bool IsNative() { return true; }\n\n\n\n   HFONT mFont;\n   TEXTMETRIC mMetrics;\n   int mPixelHeight;\n};\n\nint CALLBACK MyEnumFontFunc(\n    const LOGFONTW *lpelfe,\n    const TEXTMETRICW *lpntme,\n    DWORD FontType,\n    LPARAM lParam\n)\n{\n   return 0;\n}\n\n\n\nFontFace *FontFace::CreateNative(const TextFormat &inFormat,double inScale)\n{\n   //The height needs to be >=1, 0 causes the font mapper to use the default height\n   int height = (int)std::max(( 0.5 + inFormat.size*inScale ), 1.0);\n   LOGFONTW desc;\n   memset(&desc,0,sizeof(desc));\n\n   desc.lfHeight = -height;\n   //desc.lfWidth; \n   //desc.lfEscapement; \n   //desc.lfOrientation; \n   desc.lfWeight = inFormat.bold ? FW_BOLD : FW_NORMAL;\n   desc.lfItalic = inFormat.italic;\n   desc.lfUnderline = inFormat.underline;\n   //desc.lfStrikeOut; \n   desc.lfCharSet = DEFAULT_CHARSET; \n   desc.lfOutPrecision = OUT_RASTER_PRECIS; \n   desc.lfClipPrecision = CLIP_DEFAULT_PRECIS; \n   desc.lfQuality = ANTIALIASED_QUALITY; \n   desc.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; \n   wcsncpy(desc.lfFaceName,inFormat.font(L"times").c_str(),LF_FACESIZE);\n\n   if (!sgFontDC)\n   {\n      sgFontDC = CreateCompatibleDC(0);\n      SetBkColor(sgFontDC, RGB(0,0,0));\n      SetTextColor(sgFontDC, RGB(255,255,255));\n      SetTextAlign( sgFontDC, TA_TOP );\n   }\n\n   // Check to see if it is there....\n  int bad =  EnumFontFamiliesExW(sgFontDC, &desc, MyEnumFontFunc, 0, 0 );\n  if (bad)\n  {\n     return 0;\n  }\n\n   HFONT hfont = CreateFontIndirectW( &desc );\n   if (!hfont)\n     return 0;\n\n   return new GDIFont(hfont,height, inFormat.bold, inFormat.italic);\n}\n\n} // end namespace nme\n', 'message': 'Add some more font aliases\n', 'author_name': 'Hugh', 'lang': 'cpp'}