History log of /haiku/src/servers/app/font/GlyphLayoutEngine.h
Revision Date Author Comments
# 118eb809 23-Feb-2024 Máximo Castañeda <antiswen@yahoo.es>

app_server: update Symbols2 font name

It's changed in the version included in current noto package.

Fixes #18815

Change-Id: I6e2db902dff0f72f1a13ef5eafb2b9963e466e4a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7425
Reviewed-by: Máximo Castañeda <antiswen@yahoo.es>


# 4d6b8a57 10-Feb-2024 Jérôme Duval <jerome.duval@gmail.com>

app_server: Switch default UI font to Noto Sans.

fixes #18793

Change-Id: If53229acd6c00e1a800c6808f3f0261ae59d99bb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7400
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: nephele nephele <nep-git@packageloss.eu>


# c220175c 05-Oct-2023 PulkoMandy <pulkomandy@pulkomandy.tk>

Add Noto Cherokee to font fallback list

Someone asked about it in the forum.

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


# 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>


# a4dfc6aa 22-Aug-2022 Máximo Castañeda <antiswen@yahoo.es>

app_server: fix deadlock in GlyphLayoutEngine

We want to first try fallbacks with the same style as the main font, if
available, but that introduces the chance of two threads trying to
acquire the same locks in different order, so keep at most the main font
and one fallback locked, and acquire them in a fixed order by address.

Fixes: #17850
Change-Id: Ic352fadc46eb257d2bca4804962b11ab1eb9fa12
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5557
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 22dda779 03-Jul-2021 Máximo Castañeda <antiswen@yahoo.es>

GlyphLayout: emit .nodef glyph for missing glyphs

Use glyph 0 when no glyph is found for a character in the current font
nor any of the fallbacks.

HasGlyphs has to bypass LayoutGlyphs because we want it to mark this
case as false, while still checking the fallbacks.

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


# 6aec6b1c 26-Jun-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

app_server: add Noto Emoji to font fallback list.

Helps with #16221 (somehow it doesn't seem to matter if the font is
installed or not?)


# 5d104205 09-Dec-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Add Noto Sans Symbols2 to font fallbacks

Also use the correct symbol for the return key (we were using another
similar arrow because this one was not available in DejaVu Sans).

Fixes #14034.

Note that build/jam/repositories/HaikuPorts ships an old version of the
Noto package that does not include the Symbols2 font. It should be
updated. Adding this to the pile of lagging behind packages, alongside
icu, mawk/gawk, and tnftp. Can anyone take care of it?


# a1c9aa9d 23-Oct-2020 Máximo Castañeda <antiswen@yahoo.es>

Get a fallback font for each missing character

Make the glyph layout engine look for a suitable font fallback for each
missing character, instead of using the first one found for all of them.

Solves #16404, #16213, maybe other garbled text issues.

Does not solve similar issues of getting slightly different positions and
widths for a whole string than for the sum of its parts due to subpixel
rendering (cf #15007 comment 2).

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


# 6ffd243d 06-Jun-2020 Pascal Abresch <nep@packageloss.eu>

app_server: Fall back to style "Regular" before style 0

Most notably in noto sans cjk style 0 seems be thin or light, and not Regular
this should make the fallback try Regular and only fall back to 0
if no font has a regular variant for the requested glyph

Change-Id: Ib152a50e6cace032278a60f664c2569fa9fe82fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2887
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 290fd41d 04-Jun-2020 Pascal Abresch <nep@packageloss.eu>

app_server: Fall back into non-matching font variants if necessary.

7a8d5a2db3214be378c4450bd94e07db75d5e240 introduced that the fallback tries to match the style
instead of using regular, the fallback was broken in a different way until commit
4dcd8c81b12790b0ad7661f3ab8742ae619996be fixed the remaining issue, this commit
makes the fallback first try the matching style and afterwards try the regular
style (so as to improve above falling back to regular in every case).

Fixes #16189.

Change-Id: Iee956c4c1461794b4836c94e09d66d8cbf196678
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Style fixes and use of BAutolock by me. Also changed the style fallback
to use style 0 instead of "Regular".
(cherry picked from commit 3c6422ea0fd90e002ae9f78b1ca3e67766cb3551)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2877


# afc74b61 21-May-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Add Thai font to the font fallback system.

Fixes #16077.

Change-Id: I9809dcdcad61fc2956a270ff92b1ccaef4e8efb3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2768
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 4dcd8c81 21-May-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

app_server: fix font fallback

Actually check that the replacement font contains the needed glyph.

Change-Id: I6d774361fcf16a36dc3d05ce8b0fe1cb407fabff
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2767
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# c0e0ba1f 21-May-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

GlyphLayoutEngine: cleanup, no functional change.

Change-Id: I688d4a5f1c93de10f15bd34045cf342ea03fa984
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2766
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 7a8d5a2d 29-Feb-2020 Pascal Abresch <nep@packageloss.eu>

app_server: fix fallback for fonts where the variants match.

This does not produce a satisfactory fallback if i.e "extrabold"
is selected since the CJK font does not have that, probably need to
figure out a way to change the font style so that it renders correctly
(render cjk as bold when display is at extrabold or so).

Fixes #15751.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 177db1e4 09-Jan-2019 Augustin Cavalier <waddlesplash@gmail.com>

app_server: Switch default UI font to Noto Sans Display.

Fixes #14779.


# 8071db32 28-Dec-2018 Michael Lotz <mmlr@mlotz.ch>

app_server: Add char limit to GlyphLayoutEngine::LayoutGlyphs().

Many of the consumers fill in data into preallocated arrays. Some of
them already ignored values past the array size manually, some didn't.

Add a maxChar argument and set it from the incoming array sizes for
the various consumer cases.


# 9dad3fb4 28-Dec-2018 Michael Lotz <mmlr@mlotz.ch>

app_server: Style and comment cleanup, no functional change.


# cd6365c7 17-May-2018 Jérôme Duval <jerome.duval@gmail.com>

style fixes


# a652a5fe 21-Mar-2017 Brian Hill <supernova@warpmail.net>

Reorder fallback fonts. Fixes #13389

Put the Noto Sans Symbols font last in the list of fallback fonts.


# 93b87bac 16-Mar-2017 Brian Hill <supernova@warpmail.net>

Add Noto Sans Symbols as a fallback font

Haiku should be able to display more symbol characters now with this
as a fallback font.


# 34fbc56b 04-Mar-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

Complete the transition to Noto as the default font.

- Both Noto and Noto Sans CJK JP are now used as font fallbacks,
allowing to cover a rather large range of characters. This also makes
it possible to mix the two fonts easily.
- Remove VL-Gothic from packages and from AboutSystem
- Add Noto fonts to the dependencies of the Haiku package.

This provides a similar look for all languages as discussed on the
mailing list.


# 15325401 14-Feb-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

app_server: do not return a glyph when nothing is found in the font.

- Fixes BFont::GetHasGlyphs, the "empty square" which was returned led
it to think the font had glyphs for everything
- This means the "no character" empty square will not be drawn anymore,
if we want it back, we will need to rework the implementation a bit
more (either request it explicitly when there is a missing glyph, or
return it as it was before but including an info that it is the
"missing glyph")
- Maybe GetHasGlyphs should also bypass the font fallback system, and
return what's actually in the requested font only.

This also fixes a locking problem in the GlyphLayoutEngine, the code
didn't handle the read/write lock properly and tried to ReadUnlock from
a place where only the write lock was held.


# 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.


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

Font: Work on support for spacing modes.

* Change default spacing to B_BITMAP_SPACING. The BeBook does not document
what the default spacing is, and I have no BeOS install handy to check.
However, I believe that B_BITMAP_SPACING is what should be the default,
since it gives the best visible result for the common use-case.
In terms of implementation, there is no change, since spacing was ignored
until now and the behavior was that of B_BITMAP_SPACING. This change could
however break BeOS apps which assume B_CHAR_SPACING is the default and don't
set it on new when they need it. Sample code in the BeBook however shows
setting B_CHAR_SPACING on a newly created BFont.
* Implement B_STRING_SPACING to do something sensible. The BeBook documentation
is completely vague in what it is actually supposed to do. Given the
possibilities of FreeType, I am implementing it to enable the use of
kerning. Kerning optimizes the spacing between two glyphs, for example, it
would decrease the spacing between "T" and "e" in the string "Test" for
our default font. Untested.


# 4ccc40a1 20-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fixed BFont::GetEscapements()

Both versions effectively ignored the provided escapement_delta.
Also when layouting glyphs, the space/non-space delta were applied
off-by-one. It should affect the advance for the current glyph,
not the offset.


# 24c156da 20-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Don't offset first glyph with additional spacing

Untested, but should be correct... will test in a minute.


# 750958b8 06-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Prepare to be able to force vector glyphs...

...in everything text rendering related.


# 5c6b9eb0 23-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Some fixes for GCC 4.6 warning: variable set but not used


# 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


# 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.


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

Font: Work on support for spacing modes.

* Change default spacing to B_BITMAP_SPACING. The BeBook does not document
what the default spacing is, and I have no BeOS install handy to check.
However, I believe that B_BITMAP_SPACING is what should be the default,
since it gives the best visible result for the common use-case.
In terms of implementation, there is no change, since spacing was ignored
until now and the behavior was that of B_BITMAP_SPACING. This change could
however break BeOS apps which assume B_CHAR_SPACING is the default and don't
set it on new when they need it. Sample code in the BeBook however shows
setting B_CHAR_SPACING on a newly created BFont.
* Implement B_STRING_SPACING to do something sensible. The BeBook documentation
is completely vague in what it is actually supposed to do. Given the
possibilities of FreeType, I am implementing it to enable the use of
kerning. Kerning optimizes the spacing between two glyphs, for example, it
would decrease the spacing between "T" and "e" in the string "Test" for
our default font. Untested.


# 4ccc40a15c5c250fbd5ddbefcfff5b651b102825 20-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Fixed BFont::GetEscapements()

Both versions effectively ignored the provided escapement_delta.
Also when layouting glyphs, the space/non-space delta were applied
off-by-one. It should affect the advance for the current glyph,
not the offset.


# 24c156daf59f68c8e07a268257ba39b7f55cdaa9 20-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Don't offset first glyph with additional spacing

Untested, but should be correct... will test in a minute.


# 750958b8571b7c77fb5f7305074c3bafc5795419 06-Feb-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Prepare to be able to force vector glyphs...

...in everything text rendering related.


# 5c6b9eb00d0d623c12f72eb82a471cb4c71f4f33 23-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

Some fixes for GCC 4.6 warning: variable set but not used


# 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