Use FX_GetUnicodeProperties() in more places.
Instead of accessing the raw kTextLayoutCodeProperties data.
Change-Id: Ie39cf5c098e1564ae2f18d76b234af42f24db4ca
Reviewed-on: https://pdfium-review.googlesource.com/9451
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index 79d6be2..095db8d 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -667,9 +667,9 @@
namespace arabic {
wchar_t GetFormChar(wchar_t wch, wchar_t prev, wchar_t next) {
- CFX_Char c(wch, kTextLayoutCodeProperties[static_cast<uint16_t>(wch)]);
- CFX_Char p(prev, kTextLayoutCodeProperties[static_cast<uint16_t>(prev)]);
- CFX_Char n(next, kTextLayoutCodeProperties[static_cast<uint16_t>(next)]);
+ CFX_Char c(wch, FX_GetUnicodeProperties(wch));
+ CFX_Char p(prev, FX_GetUnicodeProperties(prev));
+ CFX_Char n(next, FX_GetUnicodeProperties(next));
return GetFormChar(&c, &p, &n);
}
diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp
index 595bb65..f232004 100644
--- a/core/fxcrt/fx_unicode.cpp
+++ b/core/fxcrt/fx_unicode.cpp
@@ -24,7 +24,7 @@
uint32_t FX_GetUnicodeProperties(wchar_t wch) {
size_t idx = static_cast<size_t>(wch);
if (idx < kTextLayoutCodePropertiesSize)
- return kTextLayoutCodeProperties[(uint16_t)wch];
+ return kTextLayoutCodeProperties[idx];
return 0;
}
diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp
index fdb492d..353bdba 100644
--- a/xfa/fgas/layout/cfx_rtfbreak.cpp
+++ b/xfa/fgas/layout/cfx_rtfbreak.cpp
@@ -66,7 +66,7 @@
CFX_BreakType CFX_RTFBreak::AppendChar(wchar_t wch) {
ASSERT(m_pFont && m_pCurLine);
- uint32_t dwProps = kTextLayoutCodeProperties[static_cast<uint16_t>(wch)];
+ uint32_t dwProps = FX_GetUnicodeProperties(wch);
FX_CHARTYPE chartype = GetCharTypeFromProp(dwProps);
m_pCurLine->m_LineChars.emplace_back();