User forums > Using Code::Blocks

How to use the temporary fonts?

(1/2) > >>

Loaden:
For example there is a font named "DejaVu", I do not want to install the fonts into the system path: "C:\Windows\Fonts", then how can we use this font?

I find that OOo has such features: only copies all fonts to "share\fonts\truetype" directory.

In Windows OS, i found this API can do that:http://msdn.microsoft.com/en-us/library/dd183326(VS.85).aspx

[attachment deleted by admin]

Loaden:
This patch works fine. WinXP SP3.

--- Code: ---Index: app.cpp
===================================================================
--- app.cpp     (revision 6089)
+++ app.cpp     (working copy)
@@ -656,6 +656,18 @@

         CheckVersion();

+#ifdef __WXMSW__
+        AddFontResource(_T("tool\\font\\CONSOLA.ttf"));
+        AddFontResource(_T("tool\\font\\CONSOLAB.ttf"));
+        AddFontResource(_T("tool\\font\\CONSOLAI.ttf"));
+        AddFontResource(_T("tool\\font\\CONSOLAZ.ttf"));
+//        AddFontResource(_T("tool\\font\\DejaVuSansMono.ttf"));
+//        AddFontResource(_T("tool\\font\\DejaVuSansMono-Oblique.ttf"));
+//        AddFontResource(_T("tool\\font\\DejaVuSansMono-Bold.ttf"));
+//        AddFontResource(_T("tool\\font\\DejaVuSansMono-BoldOblique.ttf"));
+        SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
+#endif
+
         // run startup script
         try
         {

--- End code ---

Loaden:
Hi, this patch works well on XPSP3.  :)

--- Code: ---Index: app.cpp
===================================================================
--- app.cpp (revision 6089)
+++ app.cpp (working copy)
@@ -656,6 +656,17 @@
 
         CheckVersion();
 
+#ifdef __WXMSW__
+        wxString font = wxFindFirstFile(_T("share/CodeBlocks/fonts/*.*"));
+        while (!font.empty())
+        {
+            AddFontResource(font);
+            font = wxFindNextFile();
+        }
+
+        SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
+#endif
+
         // run startup script
         try
         {

--- End code ---


[attachment deleted by admin]

MortenMacFly:

--- Quote from: Loaden on January 17, 2010, 12:12:55 pm ---Hi, this patch works well on XPSP3.  :)

--- Code: ---Index: app.cpp
+        while (!font.empty())

--- End code ---

--- End quote ---
Are you sure? Because verifying if a string is empty is done using IsEmpty() on wx usually...?! Probably empty is a STL compatibility function?! (I need to check the docs...)

Loaden:

--- Quote from: MortenMacFly on January 17, 2010, 02:14:29 pm ---
--- Quote from: Loaden on January 17, 2010, 12:12:55 pm ---Hi, this patch works well on XPSP3.  :)

--- Code: ---Index: app.cpp
+        while (!font.empty())

--- End code ---

--- End quote ---
Are you sure? Because verifying if a string is empty is done using IsEmpty() on wx usually...?! Probably empty is a STL compatibility function?! (I need to check the docs...)

--- End quote ---
yes! is same.
http://docs.wxwidgets.org/stable/wx_filefunctions.html#wxfindfirstfile

Navigation

[0] Message Index

[#] Next page

Go to full version