History log of /haiku/src/servers/app/drawing/Painter/AGGTextRenderer.cpp
Revision Date Author Comments
# ef83008e 18-Jul-2020 Kacper Kasper <kacperkasper@gmail.com>

app_server: add B_UNDERSCORE_FACE support

There was some confusion (and a TODO indicating it) in ServerFont.cpp,
because the notion of "font face" from the Be API is partially
implemented using different font manager styles (bold, italic, etc),
and partially by keeping flags in a separate variable for drawing
extra things or modifying the drawing (underscore, strikeout, ...).

The implementation did not actually preserve the extra flags, and so the
underscore face attribute was lost.

Implement the actual underlining of the text in AGGTextRenderer. This
implementation is a naive one so far. In particular there are the
following limitations:
1. Line is drawn over the text - no nice gaps for descents. Ideally, the
line should not touch the letter descents, and leave some space
around them. I don't know how to retrieve the contour - it appears to
me this might require bigger refactoring of this code. I have left in
my experiments commented out in the code.
2. If the text run ends with whitespace, the whitespace is not underlined
as it should. In particular if another text run is drawn next to it
and it's expected that the underline is continuous between the two.

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


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


# 06f436b3 21-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

Use strict mode when url-decoding file requests.

We don't want '+' to become a space here.
Fixes #11109.


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


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

Regard Painter's transformation when rendering text.


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


# a2f075eb 28-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Support alpha masks for text rendering...

... both vector and bitmap based. Sub-pixel text rendering not yet handled,
I think the scanline is used differently in this case, in that three times the
horizontal resolution is used, while the alpha map doesn't match this
increase.


# d592954e 29-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

app_server: avoids referencing a temporary IntRect instance.

* GCC lets us use a const reference to a temporary, but using it after it disappeared
is incorrect.
* reverts hrev45576 as this patch seems more correct.


# 3fed1a15 05-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Get app_server working on x86_64.

With this commit, app_server now compiles and runs at boot! Nothing
particularly interesting happens, just the blue background and a mouse
pointer. Remote backends are broken and not compiled in, see #8834.
Note that it won't be possible to build this quite yet, need to get
the FreeType package uploaded.


# 427427bc 09-Jan-2011 Michael Lotz <mmlr@mlotz.ch>

Create uncached glyphs on demand instead of checking glyph availability upfront.
This safes a HasGlyphs() call which would convert the whole string to glyph
codes and look each of the glyphs up in the cache entry, just to do the same
again during the loop where they are actually used. Instead we now simply switch
to the write lock and look up the fallback entry when hitting the first uncached
glyph. This benefits the normal case of having all glyphs cached without any
drawbacks.


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


# 619ccfae 28-Sep-2010 Stephan Aßmus <superstippi@gmx.de>

* Removed a line of long-dead code.
* Make sure that turning off anti-aliased font rendering
also works when subpixel-anti-aliasing is used.


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


# 77e5acc0 15-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Extended the BView drawing API by a DrawString() version that takes an array
of locations, one for each glyph.
* Added a test for the new functionality.


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


# 7f5bbbdc 26-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed PI, and PI2 from math.h.
* Replaced all occurences with the standard macros M_PI, and M_PI_2.
* Some coding style cleanup on the touched files, no other changes besides
adding a missing check for a failed memory allocation.


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


# ff4aa6dc 09-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Style cleanup


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


# 0a31071e 28-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

stippi+axeld:
* DrawString() took the fast clipping path for rotated fonts which didn't work
out (visible when moving a window over the rotated texts in DriveSetup).
* Also, made it work correctly when using sheared fonts.
* Fixed typo.
* Automatic whitespace cleanup.


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


# de2dcd9a 10-Sep-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed another round of gcc4 warnings

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


# 59e13a3f 03-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Andrej Spielmann (GSoC):
* Simplified the subpixel related methods for the AGG "pixel format" template
interface, the ones for the solid cover simply pass through the existing
methods, so only one subpixel blending function is left which does the actual
work (this removes a lot of the previously added code)
* Implemented a new rasterizer based on the original AGG rasterizer which
implements subpixel anti-aliasing for any generic AGG vector pipelines. It
is now optionally used in Painter and AGGTextRenderer (for vector fonts, ie
rotated, sheared or big enough fonts) depending on the global subpixel
setting.
* Put all subpixel variables into the new GlobalSubpixelSettings.h|cpp
* Simplified DesktopSettings related classes a bit and renamed previous
FontSubpixelAntialiasing to just SubpixelAntialiasing.
* The private libbe functions for subpixel related settings moved from Font.cpp
to InterfaceDefs.cpp where other such functions live. They are not related
to fonts only anymore.
* Removed the subpixel related settings again from the Fonts preflet and added
them to the Appearance preflet instead.

All of the above implements subpixel anti-aliasing on a global scale, which
to my knowledge no other OS is doing at the moment. Any vector rendering
can optionally use subpixel anti-aliasing in Haiku now. The bitmap cached fonts
are still affected by the Freetype complile time #define to enable the patented
subpixel rasterization (three times wide glyphs). Vector fonts and shapes are
not affected though at the moment.



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


# fa6a00c6 10-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Andrej Spielmann (GSOC):
* Integrate the subpixel rendering with the existing drawing backend and
the font rendering.
* The font cache has got an additional rendering type for extracting and
caching glyph bitmaps that store subpixel coverage values.


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


# c9d2046f 04-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* after my last changes to font rendering, it was about 15% slower than
before (although there should be much less lock contention)
* with this change, there is quite a bit of cleanup, text drawing is now
about 20% faster than before the original changes to font caching,
mostly due to turning off the kerning feature, which at the moment
gives absolutely no benefit. The correct way of doing it might be to
use kerning depending on the provided glyph spacing mode
* removed fPenLocation from Painter, the usage should be more correct now,
since it is now consistently applied before the coordinate transformation
from view to screen (also for DrawShape() now, before any view scaling
and origin offset)
* Painter no longer has it's own instance of a ServerFont, instead it uses
its AGGTextRenderer instance, which was per Painter again after the
last change, and not global anymore, made _UpdateFont() useless
* When using GlyphLayoutEngine, it supports a second pass with the same
FontCacheEntry through the introduction of a FontCacheReference. This
speeds up DrawString a little, since it needs to calculate the bounding
box for the string, and then draw the string in a second pass. This is
now done with only one FontCacheEntry lookup
* I also tried to optimize the on-the-fly conversion of UTF8->CharCode away,
since it was done four times per DrawString, but surprisingly, it proofed
to be a slight slowdown.
* introduced a shortcut in DrawingEngine::DrawString() which avoids
calculating the bounding box, we are now a tiny bit faster to figure
out that we don't need to draw any string than Dano

In the test environment (drawing to offscreen bitmap and blitting to
screen eventually), text rendering is now about 3.7 times _faster_ than Dano
text rendering (directly to screen), for untransformed text. Unfortunately
I cannot test on the same machine in accelerant using version of the test
environment.


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


# 25a70616 02-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* moved AGGTextRenderer alongside it's pal, Painter, it felt lonely,
removed font_support folder
* ServerApp can use ServerFont::StringWidth() directly again
* more ServerFont functions implemented via GlyphLayoutEngine and
custom consumer
* extended GlyphCache data structure to hole the left/right insets
of the glyph shape between its advance width, took it from the earlier
ServerFont implementation, have not tested if that gives same result
as R5
* TODO: implement GetGylphShapes via GlyphCache, although it might not
look as clean as it does now


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


# 06f436b3ac2c073913bc7e7afb56365a2ca978eb 21-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

Use strict mode when url-decoding file requests.

We don't want '+' to become a space here.
Fixes #11109.


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


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

Regard Painter's transformation when rendering text.


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


# a2f075eb427e1b5d41d094f4a43a07c0417b8fa0 28-Jan-2014 Stephan Aßmus <superstippi@gmx.de>

app_server: Support alpha masks for text rendering...

... both vector and bitmap based. Sub-pixel text rendering not yet handled,
I think the scanline is used differently in this case, in that three times the
horizontal resolution is used, while the alpha map doesn't match this
increase.


# d592954e3cf968c9e78c1b63828f0d31fe04a220 29-Apr-2013 Jérôme Duval <jerome.duval@gmail.com>

app_server: avoids referencing a temporary IntRect instance.

* GCC lets us use a const reference to a temporary, but using it after it disappeared
is incorrect.
* reverts hrev45576 as this patch seems more correct.


# 3fed1a15f58e8d6fe6b492f3b94bb3625ffeddbd 05-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Get app_server working on x86_64.

With this commit, app_server now compiles and runs at boot! Nothing
particularly interesting happens, just the blue background and a mouse
pointer. Remote backends are broken and not compiled in, see #8834.
Note that it won't be possible to build this quite yet, need to get
the FreeType package uploaded.


# 427427bc82f4f68e0b11ed1c32fda267966905c8 09-Jan-2011 Michael Lotz <mmlr@mlotz.ch>

Create uncached glyphs on demand instead of checking glyph availability upfront.
This safes a HasGlyphs() call which would convert the whole string to glyph
codes and look each of the glyphs up in the cache entry, just to do the same
again during the loop where they are actually used. Instead we now simply switch
to the write lock and look up the fallback entry when hitting the first uncached
glyph. This benefits the normal case of having all glyphs cached without any
drawbacks.


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


# 619ccfae94c8405767c5a2915580396589c69045 28-Sep-2010 Stephan Aßmus <superstippi@gmx.de>

* Removed a line of long-dead code.
* Make sure that turning off anti-aliased font rendering
also works when subpixel-anti-aliasing is used.


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


# 77e5acc0d9d737051591e663ccf3376a32bfcf84 15-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Extended the BView drawing API by a DrawString() version that takes an array
of locations, one for each glyph.
* Added a test for the new functionality.


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


# 7f5bbbdc56fa18cfc94ea649e9f1337301906e19 26-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed PI, and PI2 from math.h.
* Replaced all occurences with the standard macros M_PI, and M_PI_2.
* Some coding style cleanup on the touched files, no other changes besides
adding a missing check for a failed memory allocation.


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


# ff4aa6dc0363eabda66d032aa66cbfd1aae3d9c9 09-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Style cleanup


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


# 0a31071e2fe1833f7f89e72e7d0d91e584f69302 28-Nov-2008 Axel Dörfler <axeld@pinc-software.de>

stippi+axeld:
* DrawString() took the fast clipping path for rotated fonts which didn't work
out (visible when moving a window over the rotated texts in DriveSetup).
* Also, made it work correctly when using sheared fonts.
* Fixed typo.
* Automatic whitespace cleanup.


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


# de2dcd9ab083b31a912ffc88c9e79251dbe17826 10-Sep-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

fixed another round of gcc4 warnings

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


# 59e13a3f06eedbc797f797da71c6810634b22cd4 03-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Andrej Spielmann (GSoC):
* Simplified the subpixel related methods for the AGG "pixel format" template
interface, the ones for the solid cover simply pass through the existing
methods, so only one subpixel blending function is left which does the actual
work (this removes a lot of the previously added code)
* Implemented a new rasterizer based on the original AGG rasterizer which
implements subpixel anti-aliasing for any generic AGG vector pipelines. It
is now optionally used in Painter and AGGTextRenderer (for vector fonts, ie
rotated, sheared or big enough fonts) depending on the global subpixel
setting.
* Put all subpixel variables into the new GlobalSubpixelSettings.h|cpp
* Simplified DesktopSettings related classes a bit and renamed previous
FontSubpixelAntialiasing to just SubpixelAntialiasing.
* The private libbe functions for subpixel related settings moved from Font.cpp
to InterfaceDefs.cpp where other such functions live. They are not related
to fonts only anymore.
* Removed the subpixel related settings again from the Fonts preflet and added
them to the Appearance preflet instead.

All of the above implements subpixel anti-aliasing on a global scale, which
to my knowledge no other OS is doing at the moment. Any vector rendering
can optionally use subpixel anti-aliasing in Haiku now. The bitmap cached fonts
are still affected by the Freetype complile time #define to enable the patented
subpixel rasterization (three times wide glyphs). Vector fonts and shapes are
not affected though at the moment.



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


# fa6a00c628f07c0310bbc97db6e69aca68461b82 10-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

Patch by Andrej Spielmann (GSOC):
* Integrate the subpixel rendering with the existing drawing backend and
the font rendering.
* The font cache has got an additional rendering type for extracting and
caching glyph bitmaps that store subpixel coverage values.


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


# c9d2046fe5b12fee15b6c24960d29fd581a81cef 04-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* after my last changes to font rendering, it was about 15% slower than
before (although there should be much less lock contention)
* with this change, there is quite a bit of cleanup, text drawing is now
about 20% faster than before the original changes to font caching,
mostly due to turning off the kerning feature, which at the moment
gives absolutely no benefit. The correct way of doing it might be to
use kerning depending on the provided glyph spacing mode
* removed fPenLocation from Painter, the usage should be more correct now,
since it is now consistently applied before the coordinate transformation
from view to screen (also for DrawShape() now, before any view scaling
and origin offset)
* Painter no longer has it's own instance of a ServerFont, instead it uses
its AGGTextRenderer instance, which was per Painter again after the
last change, and not global anymore, made _UpdateFont() useless
* When using GlyphLayoutEngine, it supports a second pass with the same
FontCacheEntry through the introduction of a FontCacheReference. This
speeds up DrawString a little, since it needs to calculate the bounding
box for the string, and then draw the string in a second pass. This is
now done with only one FontCacheEntry lookup
* I also tried to optimize the on-the-fly conversion of UTF8->CharCode away,
since it was done four times per DrawString, but surprisingly, it proofed
to be a slight slowdown.
* introduced a shortcut in DrawingEngine::DrawString() which avoids
calculating the bounding box, we are now a tiny bit faster to figure
out that we don't need to draw any string than Dano

In the test environment (drawing to offscreen bitmap and blitting to
screen eventually), text rendering is now about 3.7 times _faster_ than Dano
text rendering (directly to screen), for untransformed text. Unfortunately
I cannot test on the same machine in accelerant using version of the test
environment.


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


# 25a706165200f555d65fba7648a0092a64c018af 02-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* moved AGGTextRenderer alongside it's pal, Painter, it felt lonely,
removed font_support folder
* ServerApp can use ServerFont::StringWidth() directly again
* more ServerFont functions implemented via GlyphLayoutEngine and
custom consumer
* extended GlyphCache data structure to hole the left/right insets
of the glyph shape between its advance width, took it from the earlier
ServerFont implementation, have not tested if that gives same result
as R5
* TODO: implement GetGylphShapes via GlyphCache, although it might not
look as clean as it does now


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