FontProvider
Canonical path: NemAll_Python_AllplanSettings.FontProvider
Provides the methods to obtain the list of the fonts.
CFontProvider is a singleton so that there is always only one instance of this class. This instance can be get with the Instance() method.
Examples:
Methods:
-
FontMMToPoints
–Converts mm to points
-
FontMMToTwips
–Converts mm to twips.
-
FontPointsToMM
–Converts points to mm
-
FontTwipsToMM
–Converts twips to mm
-
GetCharsetList
–dummy, is only needed for the creation of the documentation by MkDocs
-
GetFirstValidPredefinedFontID
–Get ID of the first existing predefined TTF font
-
GetFontID
–Get font ID for the given font name.
-
GetFontName
–Returns the name of the font.
-
GetNemFontIDs
–Get the list of the IDs of all Allplan's fonts
-
GetNemFonts
–Get the list of the names of all Allplan's fonts
-
GetPredefinedFontIDs
–Get the list of IDs of all installed and predefined TTF fonts
-
GetPredefinedFonts
–Get the list of names of all installed and predefined TTF fonts
-
GetSystemFontIDs
–Get the list of the IDs of all installed TTF fonts
-
GetSystemFonts
–Returns the list of the names of all installed TTF fonts
-
GetTTFFontSubtype
–Returns type of checked TTF font
-
Instance
–Get the instance of the font provider
-
NormalizeFontName
–Removes the script suffix from the font name
-
Refresh
–Reinitialize the fonts
FontMMToPoints
staticmethod
Converts mm to points
Parameters:
-
mmValue
(float
) –Value to convert in millimeters
Returns:
-
float
–value in points
FontMMToTwips
staticmethod
Converts mm to twips.
It is a font special factor (0.714) being applied in order to associate the mm unit with the real glyph size (like for vector fonts) without sub and superscripts space. So these function do not provide common standard point/twips/millimeter conversions!!!
Parameters:
-
mmValue
(float
) –Value to convert in millimeters
Returns:
-
float
–Value in twips
FontPointsToMM
staticmethod
Converts points to mm
Parameters:
-
twipsValue
(float
) –Value in points
Returns:
-
float
–Value in mm
GetCharsetList
overloaded
GetCharsetList(nFontID: int) -> tuple[bool, list[int]]
Returns the list of available charsets for the given font
Parameters:
-
nFontID
(int
) –Font ID
Returns:
-
bool
–True if at least one Charset for the given font ID exists
-
list[int]
–Charset list
GetCharsetList(fontName: str) -> tuple[bool, list[int]]
Returns the list of available charsets for the given font
Parameters:
-
fontName
(str
) –Font name
Returns:
-
bool
–True if at least one Charset for the given font name exists
-
list[int]
–Charset list
GetFirstValidPredefinedFontID
Get ID of the first existing predefined TTF font
Returns:
-
int
–font ID
GetFontID
Get font ID for the given font name.
Returned value | Meaning |
---|---|
0 | Dialog Font ID |
1-20 | Hardcoded Allplan's fonts |
21-63 | Hardcoded system's fonts |
Parameters:
-
fontName
(str
) –Name of the font
-
bCheckExistence
(int
, default:1
) –When set to True, the font with the particular ID has to be installed. If it's not the case, the function returns an empty string. When set to False, the function returns the name of the font regardless of whether it is installed or not.
Returns:
-
int
–font ID
GetFontName
Returns the name of the font.
Returns FontName corresponding to fontID. If fontID is invalid then the empty string is returned.
Parameters:
-
fontID
(int
) –ID of the font\n
-
bCheckExistence
(int
, default:1
) –When set to True, the font with the particular ID has to be installed. If it's not the case, the function returns an empty string. When set to False, the function returns the name of the font regardless of whether it is installed or not.
Returns:
-
str
–Font name. If fontID is invalid then the empty string is returned.
GetNemFontIDs
GetNemFontIDs() -> tuple[bool, list[int]]
Get the list of the IDs of all Allplan's fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[int]
–List with font IDs
GetNemFonts
GetNemFonts() -> tuple[bool, list[str]]
Get the list of the names of all Allplan's fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[str]
–List with the font names
GetPredefinedFontIDs
GetPredefinedFontIDs() -> tuple[bool, list[int]]
Get the list of IDs of all installed and predefined TTF fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[int]
–List with the font IDs
GetPredefinedFonts
GetPredefinedFonts() -> tuple[bool, list[str]]
Get the list of names of all installed and predefined TTF fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[str]
–List with the font names
GetSystemFontIDs
GetSystemFontIDs() -> tuple[bool, list[int]]
Get the list of the IDs of all installed TTF fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[int]
–List with the font IDs
GetSystemFonts
GetSystemFonts() -> tuple[bool, list[str]]
Returns the list of the names of all installed TTF fonts
Returns:
-
bool
–TRUE when at least one font is installed
-
list[str]
–List with the font names
GetTTFFontSubtype
Returns type of checked TTF font
Parameters:
-
fontName
(str
) –name of the TTF font
Returns:
-
int
–type of the TTF font
Instance
staticmethod
Instance() -> FontProvider