diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-01-14 16:00:58 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-01-14 16:25:16 +0000 |
commit | 700da51c5629f3b6a9b7c8e651cabbeb66960731 (patch) | |
tree | 5dba9ac871b61128328aacdae4c77fbd6afc3816 | |
parent | 0dadee9bf62aad09e94b336b16bf93ee01d955ff (diff) |
Resolves: fdo#58324 keep both halves of surrogate pairs if glyph isn't found
Change-Id: I8fda443bb224a7a99b992611221a65e9869da8b9
Reviewed-on: https://gerrit.libreoffice.org/1676
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | vcl/generic/glyphs/gcach_layout.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index a8ddc4965b60..a9f373eea649 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -299,6 +299,16 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar) return ((cChar == 0x200C) || (cChar == 0x200D)); } +static bool needPreviousCode(sal_Unicode cChar) +{ + return lcl_CharIsJoiner(cChar) || U16_IS_LEAD(cChar); +} + +static bool needNextCode(sal_Unicode cChar) +{ + return lcl_CharIsJoiner(cChar) || U16_IS_TRAIL(cChar); +} + //See https://bugs.freedesktop.org/show_bug.cgi?id=31016 #define ARABIC_BANDAID @@ -439,9 +449,9 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) if( nCharPos >= 0 ) { rArgs.NeedFallback( nCharPos, bRightToLeft ); - if ( (nCharPos > 0) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos-1]) ) + if ( (nCharPos > 0) && needPreviousCode(rArgs.mpStr[nCharPos-1]) ) rArgs.NeedFallback( nCharPos-1, bRightToLeft ); - else if ( (nCharPos + 1 < nEndRunPos) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos+1]) ) + else if ( (nCharPos + 1 < nEndRunPos) && needNextCode(rArgs.mpStr[nCharPos+1]) ) rArgs.NeedFallback( nCharPos+1, bRightToLeft ); } |