History log of /haiku/src/servers/app/font/FontEngine.cpp
Revision Date Author Comments
# 85b82f85 19-Jul-2022 Dale Cieslak <dcieslak@yahoo.com>

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 <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# a60e5cb4 26-May-2021 Máximo Castañeda <antiswen@yahoo.es>

Get font metrics from a bitmap if there are no outlines

FreeType only provides some font parameters for scalable fonts. In
particular, we use the FT_Face values of units_per_EM, ascender,
descender and height, which are 0 for bitmap-only fonts.

Part of #16938.

Change-Id: Iea2d87ad95f3bc1c2e27fb041da0a27c6e68be91
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4042
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 6c04dd48 16-Feb-2021 Máximo Castañeda <antiswen@yahoo.es>

Fix subpixel scanline size for fonts with bitmaps

Fixes #16788

Change-Id: If4c5a6e37ab5950c2426286d5afab59652a2a61b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3743
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 54333f51 05-Jan-2019 Stephan Aßmus <superstippi@gmx.de>

Don't do LCD subpixel filtering twice

The currently included version of libfreetype already has the LCD
subpixel filter turned on by default. With the switch from my
"averaging filter" back to Adrej Spielmann's filtering, there was now
another filtering being done on top of what Freetype already does.
There also seemed to be a problem with the left edge of cached
glyph bitmaps, which I didn't bother to look into. The visual result
of this change is that text looks much crisper, and the display
bugs at touching glyphs is gone.

On the other hand, LCD sub-pixel rendering is still turned on
globally, i.e. for all vector drawing, and for uncached rotated
text. The Freetype filtering is not applied there. This problem did
not exist in my "average filter", since it happened at the scanline
rendering level, not only for cached glyph bitmaps. It is however
not a regression introduced by this commit. It needs to be fixed
separately.

Change-Id: If93c2b85ed479670e6679227984fd8d9f77c11f6
Reviewed-on: https://review.haiku-os.org/c/855
Reviewed-by: Stefano Ceccherini <stefano.ceccherini@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 7127f732 17-Dec-2016 Augustin Cavalier <waddlesplash@gmail.com>

FontEngine: Fix warnings (and thus the build) of subpixel rendering code.


# 0666a27d 14-Jun-2015 Adrien Destugues <pulkomandy@gmail.com>

Style fixes.


# 683d99b0 10-Jan-2015 Jérôme Duval <jerome.duval@gmail.com>

app_server: fix build with Freetype 2.5.5.


# b8f4968d 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fixed B_CHAR_SPACING mode.

Since fonts are cached with a precision of one digit after the decimal point
for the font size, the char spacing values needs to be more precise. They are
now in font face units and scaled by the font size during layout. This yields
the expected results of the text positioning scaling smoothly along the base
line, even though the actual (hinted) glyph shape does not change with each
small change of the scale (or font size).


# d9d14326 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Implemented support for B_CHAR_SPACING.

It doesn't yield quiet the expected results, yet. When hinting is turned on,
FontEngine takes a measurement of the precise advance values for each
cached glyph by invoking FT_Load_Glyph() with the FT_LOAD_NO_HINTING flag,
before loading the glyph for real without that flag. In GlyphLayoutEngine.h,
the precise advance value is used for B_CHAR_SPACING. The intended result
is that glyphs are rendered hinted (according to global Appearance settings),
but spaced along the base-line with precise, unhinted advance values. An
application would use this for example to implement precise page or print
preview and also for zooming text without altering the placement of glyphs.
For Gobe Productive, problems can be observed, because we don't implement this
correctly, yet.


# d6e724d5 23-May-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Only set FT_LOAD_TARGET_LCD when we have specified it. Use FT_LOAD_TARGET_NORMAL when we havn't.

(FT_LOAD_TARGET_LIGHT might also be an option.)


# f4f30311 24-Jul-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Cleanup app server directory a bit by creating a font and a decorator sub folder.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42483 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0666a27d46887a200fe8946e9d6447a132f02bcc 14-Jun-2015 Adrien Destugues <pulkomandy@gmail.com>

Style fixes.


# 683d99b0a6da7eb1aafe464e52e8d1d1d609b266 10-Jan-2015 Jérôme Duval <jerome.duval@gmail.com>

app_server: fix build with Freetype 2.5.5.


# b8f4968d9bd0f69721ae4fa7260c59b7a649150f 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fixed B_CHAR_SPACING mode.

Since fonts are cached with a precision of one digit after the decimal point
for the font size, the char spacing values needs to be more precise. They are
now in font face units and scaled by the font size during layout. This yields
the expected results of the text positioning scaling smoothly along the base
line, even though the actual (hinted) glyph shape does not change with each
small change of the scale (or font size).


# d9d14326ca3acb76b37202f2926f9d7cff44b3f0 26-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Implemented support for B_CHAR_SPACING.

It doesn't yield quiet the expected results, yet. When hinting is turned on,
FontEngine takes a measurement of the precise advance values for each
cached glyph by invoking FT_Load_Glyph() with the FT_LOAD_NO_HINTING flag,
before loading the glyph for real without that flag. In GlyphLayoutEngine.h,
the precise advance value is used for B_CHAR_SPACING. The intended result
is that glyphs are rendered hinted (according to global Appearance settings),
but spaced along the base-line with precise, unhinted advance values. An
application would use this for example to implement precise page or print
preview and also for zooming text without altering the placement of glyphs.
For Gobe Productive, problems can be observed, because we don't implement this
correctly, yet.


# d6e724d5494b490ad4ea27ce0ea7a13e17cd8411 23-May-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Only set FT_LOAD_TARGET_LCD when we have specified it. Use FT_LOAD_TARGET_NORMAL when we havn't.

(FT_LOAD_TARGET_LIGHT might also be an option.)


# f4f30311aab9b2768d3ef7e590f85598298edfe0 24-Jul-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Cleanup app server directory a bit by creating a font and a decorator sub folder.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42483 a95241bf-73f2-0310-859d-f6bbb57e9c96