Bläddra i källkod

LibDraw: Add Font::default_bold_fixed_width_font()

We need a way to get a bold version of the default fixed-width font.
Andreas Kling 6 år sedan
förälder
incheckning
7d08116a6d
2 ändrade filer med 12 tillägg och 0 borttagningar
  1. 11 0
      Libraries/LibDraw/Font.cpp
  2. 1 0
      Libraries/LibDraw/Font.h

+ 11 - 0
Libraries/LibDraw/Font.cpp

@@ -42,6 +42,17 @@ Font& Font::default_fixed_width_font()
     return *s_default_fixed_width_font;
 }
 
+Font& Font::default_bold_fixed_width_font()
+{
+    static Font* font;
+    static const char* default_bold_fixed_width_font_path = "/res/fonts/CsillaBold7x10.font";
+    if (!font) {
+        font = Font::load_from_file(default_bold_fixed_width_font_path).leak_ref();
+        ASSERT(font);
+    }
+    return *font;
+}
+
 Font& Font::default_bold_font()
 {
     static Font* s_default_bold_font;

+ 1 - 0
Libraries/LibDraw/Font.h

@@ -46,6 +46,7 @@ public:
     static Font& default_bold_font();
 
     static Font& default_fixed_width_font();
+    static Font& default_bold_fixed_width_font();
 
     RefPtr<Font> clone() const;