diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-05-02 10:39:04 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-05-02 15:59:03 +0200 |
commit | 8ff55ff8c9779fd308cc50587d2f283d15518192 (patch) | |
tree | 91328a6cb2b8002601824b4f3881e7bb054a2988 /vcl | |
parent | 4bb730be0909d9cf55b7a44d7e916aa5de16b9f7 (diff) |
better for fix glyph font fallback with null character
Text layout code already filters out unsuitable characters,
the null character just wasn't included there because it's normally
not expected to be present in text, only something broken like
ofz34898-1.doc causes it.
This basically reverts commit 3d7ca1bd1c4cc9d468ae214ecb497f71bad340f8.
Change-Id: Ic29674d9507340c2a43098a88c0320d4253a0bf8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133689
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 5 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 3 | ||||
-rw-r--r-- | vcl/source/text/ImplLayoutArgs.cxx | 3 |
3 files changed, 3 insertions, 8 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index e2b9e79bfba4..0007e3f355d1 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -165,11 +165,6 @@ void GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, sal_Int if (nCharPos < 0 || mbFuzzing) return; - // Do not try to find fallback for null character, as that is pointless and it would break - // searching for it (the broken ofz34898-1.doc document triggers this). - if (rArgs.mrStr[nCharPos] == '\0') - return; - using namespace ::com::sun::star; if (!mxBreak.is()) diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index de3a0726c72c..ba487b0198c3 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1208,10 +1208,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt bool bRTL = false; OUStringBuffer aMissingCodeBuf(512); while (rLayoutArgs.GetNextPos( &nCharPos, &bRTL)) - { - assert(rLayoutArgs.mrStr[nCharPos] != '\0'); aMissingCodeBuf.append(rLayoutArgs.mrStr[nCharPos]); - } rLayoutArgs.ResetPos(); OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear(); diff --git a/vcl/source/text/ImplLayoutArgs.cxx b/vcl/source/text/ImplLayoutArgs.cxx index 55e01d2737b8..0638473f4168 100644 --- a/vcl/source/text/ImplLayoutArgs.cxx +++ b/vcl/source/text/ImplLayoutArgs.cxx @@ -141,6 +141,9 @@ static bool IsControlChar(sal_UCS4 cChar) // byte order markers and invalid unicode if ((cChar == 0xFEFF) || (cChar == 0xFFFE) || (cChar == 0xFFFF)) return true; + // drop null character too, broken documents may contain it (ofz34898-1.doc) + if (cChar == 0) + return true; return false; } |