Platforms to show: All Mac Windows Linux Cross-Platform

Back to CoreTextMBS class.

CoreTextMBS.AutoActivationSetting(BundleID as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The auto-activation setting for the specified bundle identifier.

bundleID: The bundle identifier used to specify a particular application bundle. If "", the current application bundle is used. If kCTFontManagerBundleIdentifier is specified, sets global auto-activation.
(Read and Write computed property)

CoreTextMBS.AvailableFontFamilyNames as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of visible font family names sorted for user interface display.

Some examples using this method:

CoreTextMBS.AvailableFontURLs as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an array of font URLs.

CoreTextMBS.AvailablePostScriptNames as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of unique PostScript font names for the fonts.

Some examples using this method:

CoreTextMBS.CompareFontFamilyNames(name1 as string, name2 as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
A comparator function to compare font family names and sort them according to Apple guidelines.

family1: The first localized font family name to compare, as a string.
family2: The second localized font family name to compare, as a string.

Returns a CFComparisonResult value indicating the sort order for the two family names. kCFComparisonResultGreatherThan (1) if family1 is greater than family2, kCFComparisonResultLessThan (-1) if family1 is less than family2, and kCFComparisonResultEqualTo (0) if they are equal.

This CFComparatorFunction function compares font family names and sorts them in the Apple preferred order, accounting for foundry prefix. Family names with recognized prefixes are sorted after the unprefixed names in prefix order.

CoreTextMBS.CoreTextVersion as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the version of the CoreText framework.

This function returns a number indicating the version of the CoreText framework. Note that framework version is not always an accurate indicator of feature availability. The recommended way to use this function is first to check that the function pointer is non nil (plugin will do and raise exceptions), followed by calling it and comparing its result to a defined constant (or constants).
Returns the version number. This value is for comparison with the constants beginning with kCTVersionNumber.

CoreTextMBS.CreateFontDescriptorFromData(data as memoryblock) as CTFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a font descriptor representing the font in the supplied data.

Note: the font descriptor is not available through font descriptor matching.

data: A memoryblock containing font data.

Returns a font descriptor created from the data, or nil on error.

See also:

CoreTextMBS.CreateFontDescriptorFromData(data as string) as CTFontDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a font descriptor representing the font in the supplied data.

Note: the font descriptor is not available through font descriptor matching.

data: A string containing font data.

Returns a font descriptor created from the data, or nil on error.

See also:

CoreTextMBS.CreateFontDescriptorsFromFile(file as folderitem) as CTFontDescriptorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of font descriptors representing each of the fonts in the specified file.
Example
Var file as FolderItem = SpecialFolder.Desktop.Child("Didot.ttc")

Var descriptor() as CTFontDescriptorMBS
Var result() as string

descriptor = CoreTextMBS.CreateFontDescriptorsFromFile(file)

for i as Integer = 0 to descriptor.Ubound
result.append descriptor(i).Displayname
next

MsgBox Join(result, EndOfLine)

file: A folderitem referencing a valid font file.

CoreTextMBS.CreateFontDescriptorsFromURL(URL as string) as CTFontDescriptorMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of font descriptors representing each of the fonts in the specified URL.

URL: A file system URL referencing a valid font file.

CoreTextMBS.EnableFontDescriptors(descriptors() as CTFontDescriptorMBS, enable as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Enables or disables the matching font descriptors for font descriptor matching.

descriptors: Array of font descriptors.
enable: Boolean value indicating whether the fonts matching descriptors should be enabled for font descriptor matching.

CoreTextMBS.GetScopeForFile(file as folderitem) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the registration scope of the specified folderitem.

The registration scope of the specified file or kCTFontManagerScopeNone if not currently registered.
Available in OS X v10.6 and later.

CoreTextMBS.GetScopeForURL(URL as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the registration scope of the specified URL.

The registration scope of the specified URL or kCTFontManagerScopeNone if not currently registered.
Available in OS X v10.6 and later.

CoreTextMBS.IsSupportedFontFile(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Determines whether the referenced font data is supported on the current platform.

Returns true if the folderitem refers to a valid font that can be used on the current platform; false otherwise.

CoreTextMBS.IsSupportedFontURL(URL as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Determines whether the referenced font data (usually by file URL) is supported on the current platform.

Returns true if the URL refers to a valid font that can be used on the current platform; false otherwise.

CoreTextMBS.MatchFontDescriptorsWithProgressHandler(descriptors() as CTFontDescriptorMBS, mandatoryAttributes() as string, tag as Variant = nil) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Matches font descriptors in background.

This function returns immediately, but can potentially take long time to process. The progress is notified via progress evnet.

descriptors: An array of descriptors to process.
mandatoryAttributes: some mandatory attributes.
Returns false if it couldn't start the work.

CoreTextMBS.RegisterFontsForFile(file as folderitem, scope as Integer, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Registers fonts from the specified font URL with the Font Manager. Registered fonts are discoverable through font descriptor matching.

fontURL: The font URL.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
error: a CFErrorMBS object which, in case of failed registration, contains error information.

Returns true if registration of the fonts was successful, otherwise false.

CoreTextMBS.RegisterFontsForFiles(files() as folderitem, scope as Integer, errors() as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Registers fonts from the specified array of font URLs with the Font Manager. Registered fonts are discoverable through font descriptor matching.

files: Array of font files.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
errors: An array of CFErrorMBS objects which, in case of failed registration, contain error information. Each error contains a CFArrayMBS of font URLs corresponding to kCTFontManagerErrorFontURLsKey. These URLs represent the font files that caused the error and were not successfully registered. The array must be released by the caller. Can be nil.

Returns true if registration of all font URLs was successful, otherwise false.

CoreTextMBS.RegisterFontsForURL(URL as string, scope as Integer, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Registers fonts from the specified font URL with the Font Manager. Registered fonts are discoverable through font descriptor matching.

fontURL: The font URL.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
error: a CFErrorMBS object which, in case of failed registration, contains error information.

Returns true if registration of the fonts was successful, otherwise false.

See also:

CoreTextMBS.RegisterFontsForURL(URLs() as string, scope as Integer, errors() as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Registers fonts from the specified array of font URLs with the Font Manager. Registered fonts are discoverable through font descriptor matching.

URLs: Array of font URLs.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
errors: Array of CFErrorMBS objects which, in case of failed registration, contain error information. Each error contains a CFArrayMBS of font URLs corresponding to kCTFontManagerErrorFontURLsKey. These URLs represent the font files that caused the error and were not successfully registered. The array must be released by the caller. Can be nil.

Please pass in errors array empty as
Returns true if registration of all font URLs was successful, otherwise false.

See also:

CoreTextMBS.RegisterGraphicsFont(font as CGFontMBS, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Registers the specified graphics font with the font manager.

font: The graphics font to be registered.
error: Returns by indirection an error object in the case of failed registration.

Returns true if registration of the font was successful, otherwise false.

Registered fonts are discoverable through font descriptor matching. Any attempt to register a font that is either already registered or contains the same Postscript of an already registered font will fail. This behavior is useful for fonts that may be embedded in documents or constructed in memory. A graphics font is obtained by calling CGFontMBS.CreateWithDataProvider. Fonts that are backed by files should be registered using CoreTextMBS.RegisterFontsForURL.

CoreTextMBS.UnregisterFontsForFile(file as folderitem, scope as Integer, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Unregisters fonts from the specified font URL with the Font Manager. Unregistered fonts are no longer discoverable through font descriptor matching.

URL: The font URL.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
error: A CFError object which, in case of failed registration, contains error information.

Returns true if unregistration of the fonts was successful, otherwise false.

CoreTextMBS.UnregisterFontsForFiles(files() as folderitem, scope as Integer, errors() as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Unregisters fonts from the specified array of font URLs with the Font Manager. Unregistered fonts are no longer discoverable through font descriptor matching.

files: Array of font folderitems.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
errors: An array of CFError objects which, in case of failed registration, contain error information. Each error contains a CFArray of font URLs corresponding to kCTFontManagerErrorFontURLsKey. These URLs represent the font files that caused the error and were not successfully registered. The array must be released by the caller.

Returns true if unregistration of all font URLs was successful, otherwise false.

CoreTextMBS.UnregisterFontsForURL(URL as string, scope as Integer, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Unregisters fonts from the specified font URL with the Font Manager. Unregistered fonts are no longer discoverable through font descriptor matching.

URL: The font URL.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
error: A CFError object which, in case of failed registration, contains error information.

Returns true if unregistration of the fonts was successful, otherwise false.

CoreTextMBS.UnregisterFontsForURLs(URLs() as string, scope as Integer, errors() as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Unregisters fonts from the specified array of font URLs with the Font Manager. Unregistered fonts are no longer discoverable through font descriptor matching.

URLs: Array of font URLs.
scope: Scope constant defining the availability and lifetime of the registration. See "Font Registration Scope" for values to pass for this parameter.
errors: An array of CFError objects which, in case of failed registration, contain error information. Each error contains a CFArray of font URLs corresponding to kCTFontManagerErrorFontURLsKey. These URLs represent the font files that caused the error and were not successfully registered. The array must be released by the caller.

Returns true if unregistration of all font URLs was successful, otherwise false.

CoreTextMBS.UnregisterGraphicsFont(font as CGFontMBS, byref error as CFErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreText MBS MacCG Plugin 14.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Unregisters the specified graphics font with the font manager.

font: The graphics font to be unregistered.
error: Returns by indirection an error object in the case of failed unregistration.

Returns true if unregistration of the font was successful, otherwise false.

Unregistered fonts are no longer discoverable through font descriptor matching. Fonts that are backed by files should be unregistered using CTFontManagerUnregisterFontsForURL.

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...