BFont: allow loading of user fonts from disk or memory

This patch adds an API call to BFont, called LoadFont, that
takes a string path to a font file. The user fonts are managed
via a new class called AppFontManager that inherits from the base
class FontManagerBase but adds the methods to add and remove user
fonts from disk or memory. There is also a new method called UnloadFont
to remove a user font, but on exit of an app all user fonts should be
automatically cleaned up.

Global/system fonts are managed by the GlobalFontManager, which is
a new class that also inherits from the base class FontManagerBase,
replacing the old "FontManager" class.

A maximum of 128 user fonts may be loaded, and memory fonts
may not exceed 20MB.

There's also an overloaded version of LoadFont that accepts
an area_id and loads the font from memory. A size and offset may
optionally be provided to allow for an area that contains more
than just a font.

Change-Id: I6add42bdf0c0cefc0e2e2a4984fd848c3e7269e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4790
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Dale Cieslak
2022-12-17 12:32:09 +00:00
committed by Adrien Destugues
parent 65f096fd08
commit 85b82f8524
31 changed files with 2077 additions and 1023 deletions
+3
View File
@@ -146,6 +146,9 @@ enum {
AS_GET_TRUNCATED_STRINGS,
AS_GET_UNICODE_BLOCKS,
AS_GET_HAS_UNICODE_BLOCK,
AS_ADD_FONT_FILE,
AS_ADD_FONT_MEMORY,
AS_REMOVE_FONT,
// Screen methods
AS_VALID_SCREEN_ID,