summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_arabic.cpp11
-rw-r--r--core/fxcrt/fx_arabic.h117
-rw-r--r--core/fxcrt/fx_arb.h51
-rw-r--r--core/fxcrt/fx_ucd.h79
-rw-r--r--core/fxcrt/fx_unicode.cpp7
5 files changed, 101 insertions, 164 deletions
diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp
index 108c6c19ac..29e6e437e8 100644
--- a/core/fxcrt/fx_arabic.cpp
+++ b/core/fxcrt/fx_arabic.cpp
@@ -286,17 +286,6 @@ FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) {
namespace pdfium {
namespace arabic {
-bool IsArabicChar(FX_WCHAR wch) {
- uint32_t dwRet =
- kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK;
- return dwRet >= FX_CHARTYPE_ArabicAlef;
-}
-
-bool IsArabicFormChar(FX_WCHAR wch) {
- return (kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK) ==
- FX_CHARTYPE_ArabicForm;
-}
-
FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev, FX_WCHAR next) {
CFX_Char c(wch, kTextLayoutCodeProperties[(uint16_t)wch]);
CFX_Char p(prev, kTextLayoutCodeProperties[(uint16_t)prev]);
diff --git a/core/fxcrt/fx_arabic.h b/core/fxcrt/fx_arabic.h
index e7ba079f43..9f6ec50ef6 100644
--- a/core/fxcrt/fx_arabic.h
+++ b/core/fxcrt/fx_arabic.h
@@ -7,7 +7,10 @@
#ifndef CORE_FXCRT_FX_ARABIC_H_
#define CORE_FXCRT_FX_ARABIC_H_
-#include "core/fxcrt/fx_arb.h"
+#include <vector>
+
+#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/fx_ucd.h"
#define FX_BIDIMAXLEVEL 61
#define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L)
@@ -17,9 +20,7 @@
namespace pdfium {
namespace arabic {
-bool IsArabicChar(FX_WCHAR wch);
-bool IsArabicFormChar(FX_WCHAR wch);
-FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR next = 0);
+FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev, FX_WCHAR next);
FX_WCHAR GetFormChar(const CFX_Char* cur,
const CFX_Char* prev,
const CFX_Char* next);
@@ -46,47 +47,27 @@ int32_t FX_BidiResolveExplicit(int32_t iBaseLevel,
int32_t iNest = 0);
enum FX_BIDIWEAKSTATE {
- FX_BIDIWEAKSTATE_xa = 0,
- FX_BIDIWEAKSTATE_xr,
- FX_BIDIWEAKSTATE_xl,
- FX_BIDIWEAKSTATE_ao,
- FX_BIDIWEAKSTATE_ro,
- FX_BIDIWEAKSTATE_lo,
- FX_BIDIWEAKSTATE_rt,
- FX_BIDIWEAKSTATE_lt,
- FX_BIDIWEAKSTATE_cn,
- FX_BIDIWEAKSTATE_ra,
- FX_BIDIWEAKSTATE_re,
- FX_BIDIWEAKSTATE_la,
- FX_BIDIWEAKSTATE_le,
- FX_BIDIWEAKSTATE_ac,
- FX_BIDIWEAKSTATE_rc,
- FX_BIDIWEAKSTATE_rs,
- FX_BIDIWEAKSTATE_lc,
- FX_BIDIWEAKSTATE_ls,
- FX_BIDIWEAKSTATE_ret,
- FX_BIDIWEAKSTATE_let,
+ FX_BWSxa = 0,
+ FX_BWSxr,
+ FX_BWSxl,
+ FX_BWSao,
+ FX_BWSro,
+ FX_BWSlo,
+ FX_BWSrt,
+ FX_BWSlt,
+ FX_BWScn,
+ FX_BWSra,
+ FX_BWSre,
+ FX_BWSla,
+ FX_BWSle,
+ FX_BWSac,
+ FX_BWSrc,
+ FX_BWSrs,
+ FX_BWSlc,
+ FX_BWSls,
+ FX_BWSret,
+ FX_BWSlet
};
-#define FX_BWSxa FX_BIDIWEAKSTATE_xa
-#define FX_BWSxr FX_BIDIWEAKSTATE_xr
-#define FX_BWSxl FX_BIDIWEAKSTATE_xl
-#define FX_BWSao FX_BIDIWEAKSTATE_ao
-#define FX_BWSro FX_BIDIWEAKSTATE_ro
-#define FX_BWSlo FX_BIDIWEAKSTATE_lo
-#define FX_BWSrt FX_BIDIWEAKSTATE_rt
-#define FX_BWSlt FX_BIDIWEAKSTATE_lt
-#define FX_BWScn FX_BIDIWEAKSTATE_cn
-#define FX_BWSra FX_BIDIWEAKSTATE_ra
-#define FX_BWSre FX_BIDIWEAKSTATE_re
-#define FX_BWSla FX_BIDIWEAKSTATE_la
-#define FX_BWSle FX_BIDIWEAKSTATE_le
-#define FX_BWSac FX_BIDIWEAKSTATE_ac
-#define FX_BWSrc FX_BIDIWEAKSTATE_rc
-#define FX_BWSrs FX_BIDIWEAKSTATE_rs
-#define FX_BWSlc FX_BIDIWEAKSTATE_lc
-#define FX_BWSls FX_BIDIWEAKSTATE_ls
-#define FX_BWSret FX_BIDIWEAKSTATE_ret
-#define FX_BWSlet FX_BIDIWEAKSTATE_let
enum FX_BIDIWEAKACTION {
FX_BIDIWEAKACTION_IX = 0x100,
@@ -139,19 +120,14 @@ void FX_BidiResolveWeak(int32_t iBaseLevel,
CFX_ArrayTemplate<int32_t>& classes,
CFX_ArrayTemplate<int32_t>& levels);
enum FX_BIDINEUTRALSTATE {
- FX_BIDINEUTRALSTATE_r = 0,
- FX_BIDINEUTRALSTATE_l,
- FX_BIDINEUTRALSTATE_rn,
- FX_BIDINEUTRALSTATE_ln,
- FX_BIDINEUTRALSTATE_a,
- FX_BIDINEUTRALSTATE_na,
+ FX_BNSr = 0,
+ FX_BNSl,
+ FX_BNSrn,
+ FX_BNSln,
+ FX_BNSa,
+ FX_BNSna
};
-#define FX_BNSr FX_BIDINEUTRALSTATE_r
-#define FX_BNSl FX_BIDINEUTRALSTATE_l
-#define FX_BNSrn FX_BIDINEUTRALSTATE_rn
-#define FX_BNSln FX_BIDINEUTRALSTATE_ln
-#define FX_BNSa FX_BIDINEUTRALSTATE_a
-#define FX_BNSna FX_BIDINEUTRALSTATE_na
+
enum FX_BIDINEUTRALACTION {
FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L,
FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4),
@@ -166,6 +142,35 @@ enum FX_BIDINEUTRALACTION {
#define FX_BNALn FX_BIDINEUTRALACTION_Ln
#define FX_BNAIn FX_BIDINEUTRALACTION_In
#define FX_BNALnL FX_BIDINEUTRALACTION_LnL
+
+struct FX_ARBFORMTABLE {
+ uint16_t wIsolated;
+ uint16_t wFinal;
+ uint16_t wInitial;
+ uint16_t wMedial;
+};
+
+struct FX_ARAALEF {
+ uint16_t wAlef;
+ uint16_t wIsolated;
+};
+
+struct FX_ARASHADDA {
+ uint16_t wShadda;
+ uint16_t wIsolated;
+};
+
+const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode);
+FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef);
+FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda);
+
+void FX_BidiLine(std::vector<CFX_TxtChar>& chars,
+ int32_t iCount,
+ int32_t iBaseLevel = 0);
+void FX_BidiLine(std::vector<CFX_RTFChar>& chars,
+ int32_t iCount,
+ int32_t iBaseLevel = 0);
+
int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel);
int32_t FX_BidiGetResolvedNeutrals(int32_t iAction);
void FX_BidiResolveNeutrals(int32_t iBaseLevel,
diff --git a/core/fxcrt/fx_arb.h b/core/fxcrt/fx_arb.h
deleted file mode 100644
index d24197c7e5..0000000000
--- a/core/fxcrt/fx_arb.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXCRT_FX_ARB_H_
-#define CORE_FXCRT_FX_ARB_H_
-
-#include <vector>
-
-#include "core/fxcrt/fx_system.h"
-#include "core/fxcrt/fx_ucd.h"
-
-struct FX_ARBFORMTABLE {
- uint16_t wIsolated;
- uint16_t wFinal;
- uint16_t wInitial;
- uint16_t wMedial;
-};
-
-struct FX_ARAALEF {
- uint16_t wAlef;
- uint16_t wIsolated;
-};
-
-struct FX_ARASHADDA {
- uint16_t wShadda;
- uint16_t wIsolated;
-};
-
-const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode);
-FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef);
-FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda);
-
-enum FX_ARBPOSITION {
- FX_ARBPOSITION_Isolated = 0,
- FX_ARBPOSITION_Final,
- FX_ARBPOSITION_Initial,
- FX_ARBPOSITION_Medial,
-};
-
-void FX_BidiLine(CFX_WideString& wsText, int32_t iBaseLevel = 0);
-void FX_BidiLine(std::vector<CFX_TxtChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel = 0);
-void FX_BidiLine(std::vector<CFX_RTFChar>& chars,
- int32_t iCount,
- int32_t iBaseLevel = 0);
-
-#endif // CORE_FXCRT_FX_ARB_H_
diff --git a/core/fxcrt/fx_ucd.h b/core/fxcrt/fx_ucd.h
index eb4bad097e..b07b387ece 100644
--- a/core/fxcrt/fx_ucd.h
+++ b/core/fxcrt/fx_ucd.h
@@ -49,46 +49,48 @@ uint32_t FX_GetUnicodeProperties(FX_WCHAR wch);
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical);
#ifdef PDF_ENABLE_XFA
+
+// As defined in http://www.unicode.org/reports/tr14/
enum FX_CHARBREAKPROP {
- FX_CBP_OP = 0,
- FX_CBP_CL = 1,
- FX_CBP_QU = 2,
- FX_CBP_GL = 3,
- FX_CBP_NS = 4,
- FX_CBP_EX = 5,
- FX_CBP_SY = 6,
- FX_CBP_IS = 7,
- FX_CBP_PR = 8,
- FX_CBP_PO = 9,
- FX_CBP_NU = 10,
- FX_CBP_AL = 11,
- FX_CBP_ID = 12,
- FX_CBP_IN = 13,
- FX_CBP_HY = 14,
- FX_CBP_BA = 15,
- FX_CBP_BB = 16,
- FX_CBP_B2 = 17,
- FX_CBP_ZW = 18,
- FX_CBP_CM = 19,
- FX_CBP_WJ = 20,
- FX_CBP_H2 = 21,
- FX_CBP_H3 = 22,
- FX_CBP_JL = 23,
- FX_CBP_JV = 24,
- FX_CBP_JT = 25,
-
- FX_CBP_BK = 26,
- FX_CBP_CR = 27,
- FX_CBP_LF = 28,
- FX_CBP_NL = 29,
- FX_CBP_SA = 30,
- FX_CBP_SG = 31,
- FX_CBP_CB = 32,
- FX_CBP_XX = 33,
- FX_CBP_AI = 34,
- FX_CBP_SP = 35,
- FX_CBP_TB = 37,
+ FX_CBP_OP = 0, // Opening Punctuation
+ FX_CBP_CL = 1, // Closing Punctuation
+ FX_CBP_QU = 2, // Ambiguous Quotation
+ FX_CBP_GL = 3, // Non-breaking ("Glue")
+ FX_CBP_NS = 4, // Non Starter
+ FX_CBP_EX = 5, // Exclamation/Interrogation
+ FX_CBP_SY = 6, // Symbols Allowing Breaks
+ FX_CBP_IS = 7, // Infix Separator (Numeric)
+ FX_CBP_PR = 8, // Prefix (Numeric)
+ FX_CBP_PO = 9, // Postfix (Numeric)
+ FX_CBP_NU = 10, // Numeric
+ FX_CBP_AL = 11, // Ordinary Alphabetic and Symbol Characters
+ FX_CBP_ID = 12, // Ideographic
+ FX_CBP_IN = 13, // Inseparable
+ FX_CBP_HY = 14, // Hyphen
+ FX_CBP_BA = 15, // Break Opportunity After
+ FX_CBP_BB = 16, // Break Opportunity Before
+ FX_CBP_B2 = 17, // Break Opportunity Before and After
+ FX_CBP_ZW = 18, // Zero Width Space
+ FX_CBP_CM = 19, // Attached Characters and Combining Marks
+ FX_CBP_WJ = 20, // Word Joiner
+ FX_CBP_H2 = 21, // Hangul LV Syllable
+ FX_CBP_H3 = 22, // Hangul LVT Syllable
+ FX_CBP_JL = 23, // Hangul Leading Jamo
+ FX_CBP_JV = 24, // Hangul Vowel Jamo
+ FX_CBP_JT = 25, // Hangul Trailing Jamo
+
+ FX_CBP_BK = 26, // Mandatory Break
+ FX_CBP_CR = 27, // Carriage Return
+ FX_CBP_LF = 28, // Line Feed
+ FX_CBP_NL = 29, // Next Line
+ FX_CBP_SA = 30, // Complex Context (South East Asian)
+ FX_CBP_SG = 31, // Surrogate
+ FX_CBP_CB = 32, // Contingent Break Opportunity
+ FX_CBP_XX = 33, // Unknown
+ FX_CBP_AI = 34, // Ambiguous (Alphabetic or Ideographic)
+ FX_CBP_SP = 35, // Space
FX_CBP_NONE = 36,
+ FX_CBP_TB = 37, // ?
};
#define FX_CHARTYPEBITS 11
@@ -112,7 +114,6 @@ inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) {
return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK);
}
-bool FX_IsCtrlCode(FX_WCHAR ch);
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
uint32_t dwProps,
bool bRTL,
diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp
index e6f423e2af..44fa8e743d 100644
--- a/core/fxcrt/fx_unicode.cpp
+++ b/core/fxcrt/fx_unicode.cpp
@@ -13,13 +13,6 @@ uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) {
return 0;
}
-#ifdef PDF_ENABLE_XFA
-bool FX_IsCtrlCode(FX_WCHAR ch) {
- uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK);
- return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
-}
-#endif // PDF_ENABLE_XFA
-
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, bool bRTL, bool bVertical) {
uint32_t dwProps = FX_GetUnicodeProperties(wch);
uint32_t dwTemp = (dwProps & 0xFF800000);