Holds a specific font type.
More...
|
static string | GetDefaultName (string file, int size) |
| Returns an auto-generated font name based on the file name and font size. More...
|
|
|
string | Name [get] |
| Gets the name of this font instance. More...
|
|
string | File [get] |
| Gets the file used to create this font instance. More...
|
|
int | Size [get] |
| Gets the size of this font in points. More...
|
|
FontType | Type [get] |
| Gets the font type. More...
|
|
QFont | QFont [get] |
| Gets the QFont instance associated with this font. More...
|
|
Color | Color [get, set] |
| Gets or sets the color of this font. More...
|
|
string | Name [get] |
| Gets the name associated with this resource. More...
|
|
Holds a specific font type.
TriDevs.TriEngine.Text.Font.Font |
( |
string |
name, |
|
|
string |
file, |
|
|
int |
size, |
|
|
bool |
dropShadow = false , |
|
|
FontType |
type = FontType.TTF |
|
) |
| |
Initalizes a new Font instance.
- Parameters
-
name | Name to use for identifying this font, must be unique. Can be set to null to allow the constructor to auto-generate a name for the font. |
file | Path to the font file (TTF or qfont). |
size | Size (in points) to use for this font. |
dropShadow | Whether or not this font should have shadows. |
type | The type of font. This will be detected by the file extension, but can be manually specified to control the fallback type used if one was not detected from the file name |
95 name, file, size, type,
96 new FontConstructionConfig(
new QFontBuilderConfiguration(dropShadow),
97 new QFontLoaderConfiguration(dropShadow)))
Initializes a new Font instance using the specified builder configuration.
- Parameters
-
name | Name to use for identifying this font, must be unique. Can be set to null to allow the constructor to auto-generate a name for the font. |
file | Path to the font file (TTF or qfont). |
size | Size (in points) to use for this font. |
type | The type of font. This will be detected by the file extension, but can be manually specified to control the fallback type used if one was not detected from the file name |
fontConstructionConfig | The FontConstructionConfig containing relevant font build/load configurations. |
122 var ext = Path.GetExtension(_file);
124 if (
string.IsNullOrEmpty(ext))
125 throw new EngineException(
"Failed to get file extension of font file!",
126 new IOException(
"System.IO.Path.GetExtension returned null or empty for specified file."));
130 ext = ext.TrimStart(
'.').ToLower();
150 if (fontConstructionConfig.BuildConfig == null)
151 throw new EngineException(
"Builder configuration was null but requested font type requires a builder config!",
152 new ArgumentException(
"BuildConfig was null.",
"fontConstructionConfig"));
153 font =
new QFont(_file, _size, fontConstructionConfig.BuildConfig);
156 if (fontConstructionConfig.LoadConfig == null)
157 throw new EngineException(
"Loader configuration was null but requested font type requires a loader config!",
158 new ArgumentException(
"LoadConfig was null.",
"fontConstructionConfig"));
159 font =
QFont.FromQFontFile(_file, fontConstructionConfig.LoadConfig);
162 throw new EngineException(
"Unsupported font type: " + _type,
163 new ArgumentException(
"Font type unsupported.",
"type"));
167 throw new EngineException(
"Font failed to initialize!",
168 new ArgumentException(
"Font failed to initialize.",
"file"));
void TriDevs.TriEngine.Text.Font.Dispose |
( |
| ) |
|
Disposes of this font instance, releasing all unmanaged resources.
static string TriDevs.TriEngine.Text.Font.GetDefaultName |
( |
string |
file, |
|
|
int |
size |
|
) |
| |
|
static |
Returns an auto-generated font name based on the file name and font size.
- Parameters
-
file | The file name. |
size | The size (in points) of the font. |
- Returns
- The auto-generated font name.
183 return string.Format(NameFormat, Path.GetFileNameWithoutExtension(file), size);
override string TriDevs.TriEngine.Text.Font.ToString |
( |
| ) |
|
Color TriDevs.TriEngine.Text.Font.Color |
|
getset |
Gets or sets the color of this font.
string TriDevs.TriEngine.Text.Font.File |
|
get |
Gets the file used to create this font instance.
string TriDevs.TriEngine.Text.Font.Name |
|
get |
Gets the name of this font instance.
QFont TriDevs.TriEngine.Text.Font.QFont |
|
get |
Gets the QFont instance associated with this font.
int TriDevs.TriEngine.Text.Font.Size |
|
get |
Gets the size of this font in points.
FontType TriDevs.TriEngine.Text.Font.Type |
|
get |
The documentation for this class was generated from the following file: