Age | Commit message (Collapse) | Author |
|
Previously, Writer performed shaping for each span of text separately.
In certain situations, this caused incorrect glyph use, or incorrect
glyph positioning. This change updates Writer so it will also consider
neighboring text while performing shaping.
This change resolves the outstanding duplicates filed against tdf#61444.
As a side effect, this change also fixes tdf#134226.
In addition to the shaping fix, this change implements rendering for
individually-styled glyphs, which is required to fix tdf#71956. However,
this change does not implement diacritic selection, which is also
required for that issue.
Change-Id: Iab4774ffaab5ad6113778c54d02cb260a70c1010
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167699
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
Tested-by: Jenkins
|
|
... instead of tools::Rectangle.
Several problems were there:
1. First, a horizontal bounding rectangle was calculated, with due
rounding; and then the result was rotated, and after that, rounded
again. That made the resulting rotated rectangle coordinates very
imprecise.
2. Also, ceil/floor was applied without normalization; and in case
of rotated font, that meant, that sometimes the range could be not
expanded to cover partially covered pixels, but instead collapsed.
3. The rotation to angles other than 90 degree multiples was done
incorrectly, resulting in cut off parts of characters.
4. For 90 degrees, the imprecise result of sin/cos converted 0.0
into values like 3e-16, which then could be ceil'ed up to 1.
Using B2DRectangle and its transform allows to simplify and fix
the calculations easily, and avoids premature rounding. Render of
rotated text of small size is more stable with this change.
Change-Id: Idffd74b9937feb2418ab76a8d325fdaf4ff841b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165553
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
|
|
Change-Id: I8fbe02547d5045cfdb5021720b10ddd10106209a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155750
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
|
|
It has been always typedef'd to basegfx::B2DPoint since:
commit 5e218b5c51f7d9cd10bd9db832879efca41b9c75
Date: Wed Jan 12 21:19:32 2022 +0000
always use B2DPoint for DevicePoint
Change-Id: I9f5202d5a71c77dd79f1759923917c26bf68a9af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154632
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
|
|
Change how glyph coordinates are represented inside VCL to use floating
point instead of integers. Should make no functional difference because
we are still rounding them.
Change-Id: I5480ee3dec3afab50194954095fd6829ebaa4a22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154499
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
|
|
as per: https://github.com/harfbuzz/harfbuzz/issues/3888
Change-Id: I6e5a36fd0a5f4a3ceb979372d0f5d53ee5f65b0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143218
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
Change-Id: Iab83fbacab5232d34ea422183ae4bb4944686f54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140926
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
|
|
We shouldn’t be concerned whether a character is combining mark or not,
what we really care about is whether the font classifies it as mark
glyph, so check for that. Furthermore, for our purposes a mark glyph
forms a cluster with the preceding glyph, so we can use IN_CLUSTER flag
and drop the IS_DIACRITIC flag. This fixes the big above and a few other
issues I found myself.
Remove also overzealous asserts in pdfwriter, they are long past their
usefulness.
Change-Id: I7c87868a5c5877774bb42343079cad6e89380961
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140925
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
|
|
Every time I need this file, I had to lookup the file name and location.
Rename it following the pattern of other font classes and move the
header next to their headers.
Change-Id: Ia1e3ee4be9375c1110e169c593e1f8e7aad39c76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139446
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
|
|
Communicate Kashida insertion positions in an explicit way.
Rest of LibreOffice communicate adjustments to character widths (e.g.
for justification or spacing) using so-called DX array. DX array is an
array of absolute character positions (e.g. DX[n] is the position after
character n from the start of the lines, and its widths is DX[n] -
DX[n-1]).
This DX array is modified also when Kashidas are inserted after a given
character for Arabic justification, by expanding its width. VCL would
use this to know where to insert the Kashidas and how many ones.
But because DX array is used for both widths adjustments and kashida
insertion, this turns out to be a source of bugs since VCL has tosecond
guess the DX array to find which is pure width adjustment and which also
involves Kashida insertion, and the heuristics it uses are fragile.
This change adds a second array of booleans that records where Kashida
is inserted and communicates it all the way from where Kashida insertion
is decoded in Writer and down to VCL layout.
This change passes the Kashida array only when it seems necessary (e.g.
during drawing but not when measuring text since the DX array is enough
in this case). Hopefully no places where Kashida insertion needs to be
passed down were missed.
A couple of glyph and layout flags that were used for old heuristics and
no longer needed and are removed.
This also fixes:
tdf#87731
tdf#106309
tdf#108604
tdf#112849
tdf#114257
tdf#127176
tdf#145647
tdf#146199
Change-Id: I4ed0850ef2fdc3e9143341afac649e7e7d463c39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138068
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
Use the new HarfBuzz glyph flag HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL if
available to prevent kashida insertion where is would interrupt shaping
(between contextual glyphs). Previously we only prevented it when there
is a ligature across the insertion position, with this change fonts that
use contextual alternate instead of ligatures will be handled better as
well.
Change-Id: Ibb42a310c1e7dbcb225a1ba3acac82154b4edb3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137649
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
I.e. use the existing operator==. I don't feel like writing
operator<< for it just for one unittest though.
Change-Id: I63181765a4987a5d6efedc74a1e20d56a70eaa83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134947
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
setLinearPosX already takes a double so use that type for nOffset,
use DeviceCoordinate as the types where that is the type of the
source data
Change-Id: I411d5034a42648bab94d6b8789bbdd172d0cf841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134713
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
I got the meaning wrong, when the docs talk about beginning of a cluster,
that refers to text, not glyphs, so this needs to be backwards too.
Change-Id: I12ef775b033100405e3332d5611844cefb6b5a85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134173
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
When OutputDevice::ImplLayout() computes glyphs, the result
is always the same for the same string (and font etc.),
and if the function is asked to work on just a subset of the string,
the returned glyphs are often also a subset of glyphs for the full
string. Since e.g. EditEngine breaks text into lines by first
laying out a full string and then repeatedly calls the same function
for a subset of the string with increasing starting index. So if
the full result is cached, it's faster to just make a subset of that,
adjust it as necessary and return that, instead of doing a layout
again.
This requires support from harfbuzz to tell us if it's safe to break
at a given position, and HB_GLYPH_FLAG_UNSAFE_TO_BREAK is that
(https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).
I'm keeping the optimization for tdf#144515, as avoiding the extra
layout altogether is still useful.
Change-Id: I33f70f9af89be79056e464908eac0861f58d274a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132753
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: Ib5911a8ad33aefffa972f583c2b5fc7d42a2b9bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132746
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
And can't be put into impglyphitem.hxx, as then it would have
a circular dependency with fontinstance.hxx .
Change-Id: I57289fa5433851f095f7b73ce842ba5a0e8497ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132745
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I20bbb0e252ffd09901f587599430e715dbe977b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128300
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
The class itself is already VCL_DLLPUBLIC.
Change-Id: Ic1c352ebce8fbee4602ddc84b2db22eb0038b5e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126075
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Change-Id: I11cb916285c72f7cd85ea5d5c943f23d0a4f6bc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124148
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
we already store it in SalLayoutGlyphsImpl
Change-Id: I772c08966572e42789bcede1a148b2b7710f29d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121602
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
56 bytes -> 48 bytes
Change-Id: I30d9763162b701e3d07a153deae3f5e03c290393
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121583
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: Id54e7545b3a69e03c29daf9d372bbf605312f547
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113036
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
|
|
Change-Id: Ie85c7891cf65699529e0cc08746450bb3bc0aedb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112773
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Code that needs to lay out texts repeatedly can cache the result
of SalLayout::GetGlyphs() can reuse it. But GetGlyphs() returns
nullptr for MultiSalLayout, so caching for it doesn't work. Worse
still, it actually increases the number of layout calls, because
there's the initial layout for caching and then each call
will need to do the layout again because of the nullptr that's
not cached.
This commit changes SalLayoutGlyphs to possibly include multiple
SalLayoutGlyphsImpl objects, one for each SalLayout handled
by MultiSalLayout. Changes include making GenericSalLayout
work directly with the Impl class, which avoids an indirection
and simplifies code.
Change-Id: Ic4b19934a8a06d4955b51527fe3777c5e91107b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112590
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
...thereby avoiding -Wdeprecated-copy-dtor when the implicitly-declared copy
assignment op is used, but whose non-deleted definition was deprecated because
of the user-provided dtor
Change-Id: I9c4adc4b9ad0634c0afe5a4a707cc3697dbfae32
Reviewed-on: https://gerrit.libreoffice.org/84020
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: Ie2285f64919d1c83b0a8df4ceb827f731e5cd609
Reviewed-on: https://gerrit.libreoffice.org/75739
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
This hides all the data, which shouldn't change after init. Real
const makes a lot of problems for copying, so this is the 2nd
option to just add getters for private data. While at it use
typed_flags for the GlyphItemFlags.
Change-Id: Ic1eeabe2398f6c30080fdd516285b72c620b11be
Reviewed-on: https://gerrit.libreoffice.org/75147
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
|
|
This was broken because GenericSalLayout::LayoutText() sets the
SalLayoutFlags::KashidaJustification flag as a side-effect of building
the glyph list. So in case we cache the list and not build it, the flag
will be missing. This means that later in
GenericSalLayout::ApplyDXArray() kashida glyphs won't be inserted.
With this, the workaround in sw can be removed.
Change-Id: Ic18211bf50ca673daa238e8950a381915e4b3096
Reviewed-on: https://gerrit.libreoffice.org/69566
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
|
|
Change-Id: I5697d2b7961ce714835316879610f23aeabbd8ec
Reviewed-on: https://gerrit.libreoffice.org/69030
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
This sets the FreetypeFont pointer of the FreetypeFontInstances
to nullptr when clearing the cache.
And it changes the interface functions of SalLayoutGlyphs to some
variant different from std::vector.
I don't know if we should prefer the mutable or the const font
instance. With mutable at least one can invalidate the font
instance when checking the IsValid(), so we can get rid of our
referenced font instance.
Change-Id: I6070cfcb3c549dbad3383bd4ec2b05b30645b753
Reviewed-on: https://gerrit.libreoffice.org/62688
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
|
|
As we already rely on the GlyphItem's font instance, consequently
this removes the SalGraphics GlyphItem based functions. Also
unifies the glyph bound rect cache handling.
An interesting aspect is the rotated glyph bounding box handling
moved from CairoTextRender to FreetypeFont. It doesn't look like
an implementation detail for Cairo, so it may have been a bug.
Change-Id: I81bbb5d8ee98fb77a1eee05568c456f9e4553023
Reviewed-on: https://gerrit.libreoffice.org/62503
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
|
|
Now that we store the LogicalFontInstance instead of the fallback
level, it's not enough to keep a pointer in the glyphs in
SalLayoutGlyphsImpl. We also need a reference to the font, to
keep the font instance alive.
Change-Id: Idc99cf9259af6be672a97ab2c67dbffd9cf29c70
Reviewed-on: https://gerrit.libreoffice.org/62520
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
|
|
Nobody outside of VCL should deal with GlyphItems.
Change-Id: Id84b0f320bc49f790658f23efe129b92262c2aea
Reviewed-on: https://gerrit.libreoffice.org/62446
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
|
|
The FreetypeFont might already have released the font instance of
the glyph, but the glyphs font instance must still be valid, so
use this instead to cache glyph bound rect.
For whatever reason the Windows compiler doesn't accept inline
functions in the GlyphItem struct and wants to export them in
the DLL, even when declared VCL_DLLPRIVATE, so this just uses
static inlines as a workaround.
Change-Id: I4539d91a846a54a05f9648638494e1e99f704b0a
Reviewed-on: https://gerrit.libreoffice.org/62425
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
|