rename Font to FontRef

for consistency with SymbolFontRef
This commit is contained in:
GenevensiS
2026-02-07 02:45:41 +01:00
parent d2dce6617d
commit 42b9c241f3
16 changed files with 33 additions and 33 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ public:
ChoicePopupStyle popup_style; ///< Style of popups/menus
ChoiceRenderStyle render_style; ///< Style of rendering
Font font; ///< Font for drawing text (when RENDER_TEXT)
FontRef font; ///< Font for drawing text (when RENDER_TEXT)
CachedScriptableImage image; ///< Image to draw (when RENDER_IMAGE)
map<String,ScriptableImage> choice_images; ///< Images for the various choices (when RENDER_IMAGE)
bool choice_images_initialized;
+1 -1
View File
@@ -41,7 +41,7 @@ public:
InfoStyle(const InfoFieldP&);
DECLARE_STYLE_TYPE(Info);
Font font; ///< Font to use for the text
FontRef font; ///< Font to use for the text
Alignment alignment; ///< Alignment inside the box
double padding_left, padding_right; ///< Padding
double padding_top, padding_bottom;
+1 -1
View File
@@ -44,7 +44,7 @@ public:
PackageChoiceStyle(const PackageChoiceFieldP& field);
DECLARE_STYLE_TYPE(PackageChoice);
Font font; ///< Font to use for the text
FontRef font; ///< Font to use for the text
int update(Context&) override;
};
+1 -1
View File
@@ -73,7 +73,7 @@ public:
TextStyle(const TextFieldP&);
DECLARE_STYLE_TYPE(Text);
Font font; ///< Font to use for the text
FontRef font; ///< Font to use for the text
SymbolFontRef symbol_font; ///< Symbol font for symbols in the text
bool always_symbol; ///< Should everything be drawn as symbols?
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
+9 -9
View File
@@ -14,7 +14,7 @@
// ----------------------------------------------------------------------------- : Font
Font::Font()
FontRef::FontRef()
: name()
, size(1)
, underline(false)
@@ -33,7 +33,7 @@ Font::Font()
, flags(FONT_NORMAL)
{}
bool Font::PreloadResourceFonts(bool recursive) {
bool FontRef::PreloadResourceFonts(bool recursive) {
#if wxUSE_PRIVATE_FONTS
String pathSeparator(wxFileName::GetPathSeparator());
String appPath(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath());
@@ -68,7 +68,7 @@ bool Font::PreloadResourceFonts(bool recursive) {
return false;
}
void Font::TallyResourceFonts(String fontsDirectoryPath, vector<String>& fontFilePaths, bool recursive) {
void FontRef::TallyResourceFonts(String fontsDirectoryPath, vector<String>& fontFilePaths, bool recursive) {
wxDir fontsDirectory(fontsDirectoryPath);
String fontFileName = _("");
bool hasNext = fontsDirectory.GetFirst(&fontFileName);
@@ -86,7 +86,7 @@ void Font::TallyResourceFonts(String fontsDirectoryPath, vector<String>& fontFil
}
}
bool Font::update(Context& ctx) {
bool FontRef::update(Context& ctx) {
bool changes = false;
changes |= name .update(ctx);
changes |= italic_name .update(ctx);
@@ -108,7 +108,7 @@ bool Font::update(Context& ctx) {
| (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL);
return changes;
}
void Font::initDependencies(Context& ctx, const Dependency& dep) const {
void FontRef::initDependencies(Context& ctx, const Dependency& dep) const {
name .initDependencies(ctx, dep);
italic_name .initDependencies(ctx, dep);
size .initDependencies(ctx, dep);
@@ -126,8 +126,8 @@ void Font::initDependencies(Context& ctx, const Dependency& dep) const {
stroke_radius .initDependencies(ctx, dep);
}
FontP Font::make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const {
FontP f(new Font(*this));
FontRefP FontRef::make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const {
FontRefP f(new FontRef(*this));
f->flags |= add_flags;
if (add_flags & FONT_CODE_STRING) {
f->color = Color(0,0,100);
@@ -163,7 +163,7 @@ FontP Font::make(int add_flags, bool add_underline, bool add_strikethrough, Stri
}
static const String BOLD_STRING = _(" Bold");
wxFont Font::toWxFont(double scale) const {
wxFont FontRef::toWxFont(double scale) const {
int size_i = to_int(scale * size);
wxFontWeight weight_i = flags & FONT_BOLD ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
wxFontStyle style_i = flags & FONT_ITALIC ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
@@ -203,7 +203,7 @@ wxFont Font::toWxFont(double scale) const {
return font;
}
IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
IMPLEMENT_REFLECTION_NO_SCRIPT(FontRef) {
REFLECT(name);
REFLECT(size);
REFLECT(weight);
+5 -5
View File
@@ -13,11 +13,11 @@
#include <script/scriptable.hpp>
#include <gfx/color.hpp>
DECLARE_POINTER_TYPE(Font);
DECLARE_POINTER_TYPE(FontRef);
// ----------------------------------------------------------------------------- : Font
enum FontFlags
enum FontRefFlags
{ FONT_NORMAL = 0
, FONT_BOLD = 0x01
, FONT_ITALIC = 0x02
@@ -32,7 +32,7 @@ enum FontFlags
/// A reference to a font for rendering text
/** Contains additional information about scaling, color and shadow */
class Font : public IntrusivePtrBase<Font> {
class FontRef : public IntrusivePtrBase<FontRef> {
public:
Scriptable<String> name; ///< Name of the referenced font
Scriptable<String> italic_name; ///< Font name for italic text (optional)
@@ -53,7 +53,7 @@ public:
Color separator_color; ///< Color for <sep> text
int flags; ///< FontFlags for this font
Font();
FontRef();
/// Load fonts (.ttf or .otf) from all directories in the app directory that contain "fonts" in their names,
/// and optionaly their subdirectories, returns true if there were errors
@@ -76,7 +76,7 @@ public:
}
/// Add style, and optionally change the font family, color and size
FontP make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const;
FontRefP make(int add_flags, bool add_underline, bool add_strikethrough, String const* other_family, Color const* other_color, double const* other_size) const;
/// Convert this font reference to a wxFont
wxFont toWxFont(double scale) const;
+1 -1
View File
@@ -84,7 +84,7 @@ public:
bool regex; ///< Should this symbol be matched by a regex?
int draw_text; ///< The index of the captured regex expression to draw, or -1 to not draw text
Regex code_regex; ///< Regex for matching the symbol code
FontP text_font; ///< Font to draw text in.
FontRefP text_font; ///< Font to draw text in.
Alignment text_alignment;
double text_margin_left;
double text_margin_right;
+1 -1
View File
@@ -15,7 +15,7 @@
#include <data/font.hpp>
#include <wx/regex.h>
DECLARE_POINTER_TYPE(Font);
DECLARE_POINTER_TYPE(FontRef);
DECLARE_POINTER_TYPE(SymbolFont);
DECLARE_POINTER_TYPE(SymbolInFont);
DECLARE_POINTER_TYPE(InsertSymbolMenu);