diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-04-27 12:27:52 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-04-27 22:45:52 +0200 |
commit | 3a407fc49490a348a8147a59dae242aa21708c31 (patch) | |
tree | 01abb84df8af57665e099aa30629b91c87a9a1f0 /vcl/source/outdev/text.cxx | |
parent | 6d36d7185b025c77db9dcccea1861d37dd6bcc1b (diff) |
make SalLayoutFlags match after makeGlyphsSubset()
SalLayoutFlags::BiDiStrong would be set by ImplLayout() if the entire
subset had no RTL, but the entire string may not be that, so when
creating a subset make sure to also set this flag. Similarly
SalLayoutFlags::KashidaJustification should be set only if any
glyph in the range has GlyphItemFlags::ALLOW_KASHIDA.
Change-Id: I0aa2526f2fdd0c6a6b905ad0cb4040ee556529a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133502
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/outdev/text.cxx')
-rw-r--r-- | vcl/source/outdev/text.cxx | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 840341502beb..7d3662d0604d 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1170,28 +1170,7 @@ vcl::text::ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, if( nEndIndex < nMinIndex ) nEndIndex = nMinIndex; - if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl ) - nLayoutFlags |= SalLayoutFlags::BiDiRtl; - if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiStrong ) - nLayoutFlags |= SalLayoutFlags::BiDiStrong; - else if( !(mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl) ) - { - // Disable Bidi if no RTL hint and only known LTR codes used. - bool bAllLtr = true; - for (sal_Int32 i = nMinIndex; i < nEndIndex; i++) - { - // [0x0000, 0x052F] are Latin, Greek and Cyrillic. - // [0x0370, 0x03FF] has a few holes as if Unicode 10.0.0, but - // hopefully no RTL character will be encoded there. - if (rStr[i] > 0x052F) - { - bAllLtr = false; - break; - } - } - if (bAllLtr) - nLayoutFlags |= SalLayoutFlags::BiDiStrong; - } + nLayoutFlags |= GetBiDiLayoutFlags( rStr, nMinIndex, nEndIndex ); if( !maFont.IsKerning() ) nLayoutFlags |= SalLayoutFlags::DisableKerning; @@ -1251,6 +1230,36 @@ vcl::text::ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, return aLayoutArgs; } +SalLayoutFlags OutputDevice::GetBiDiLayoutFlags( std::u16string_view rStr, + const sal_Int32 nMinIndex, + const sal_Int32 nEndIndex ) const +{ + SalLayoutFlags nLayoutFlags = SalLayoutFlags::NONE; + if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl ) + nLayoutFlags |= SalLayoutFlags::BiDiRtl; + if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiStrong ) + nLayoutFlags |= SalLayoutFlags::BiDiStrong; + else if( !(mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl) ) + { + // Disable Bidi if no RTL hint and only known LTR codes used. + bool bAllLtr = true; + for (sal_Int32 i = nMinIndex; i < nEndIndex; i++) + { + // [0x0000, 0x052F] are Latin, Greek and Cyrillic. + // [0x0370, 0x03FF] has a few holes as if Unicode 10.0.0, but + // hopefully no RTL character will be encoded there. + if (rStr[i] > 0x052F) + { + bAllLtr = false; + break; + } + } + if (bAllLtr) + nLayoutFlags |= SalLayoutFlags::BiDiStrong; + } + return nLayoutFlags; +} + static OutputDevice::FontMappingUseData* fontMappingUseData = nullptr; static inline bool IsTrackingFontMappingUse() |