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:
FontMMToPoints
staticmethod
Converts mm to points
Parameters:
-
mmValue
(float
) –Value to convert in millimeters
Returns:
-
float
–Value in points
FontMMToTwips
staticmethod
Font size conversions.
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!!! Converts mm to twips
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
Returns 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
-
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]]
Returns 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]]
Returns 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]]
Returns the list of then 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]]
Returns the list of then 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]]
Returns 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