Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: xfa/fgas/layout/fgas_unicode.cpp

Issue 1991143003: Cleanup unused fgas/ code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fgas/layout/fgas_unicode.h" 7 #include "xfa/fgas/layout/fgas_unicode.h"
8 8
9 void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd) { 9 void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd) {
10 ASSERT(iStart > -1 && iStart < tpos.GetSize()); 10 ASSERT(iStart > -1 && iStart < tpos.GetSize());
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 } 41 }
42 i--, j++; 42 i--, j++;
43 if (iStart < i) { 43 if (iStart < i) {
44 FX_TEXTLAYOUT_PieceSort(tpos, iStart, i); 44 FX_TEXTLAYOUT_PieceSort(tpos, iStart, i);
45 } 45 }
46 if (j < iEnd) { 46 if (j < iEnd) {
47 FX_TEXTLAYOUT_PieceSort(tpos, j, iEnd); 47 FX_TEXTLAYOUT_PieceSort(tpos, j, iEnd);
48 } 48 }
49 } 49 }
50 static const FX_JAPCHARPROPERTYEX gs_FX_JapCharPropertysEx[] = {
51 {0x3001, 0x13}, {0x3002, 0x13}, {0x3041, 0x23}, {0x3043, 0x23},
52 {0x3045, 0x23}, {0x3047, 0x23}, {0x3049, 0x23}, {0x3063, 0x23},
53 {0x3083, 0x23}, {0x3085, 0x23}, {0x3087, 0x23}, {0x308E, 0x23},
54 {0x3095, 0x23}, {0x3096, 0x23}, {0x30A1, 0x23}, {0x30A3, 0x23},
55 {0x30A5, 0x23}, {0x30A7, 0x23}, {0x30A9, 0x23}, {0x30C3, 0x23},
56 {0x30E3, 0x23}, {0x30E5, 0x23}, {0x30E7, 0x23}, {0x30EE, 0x23},
57 {0x30F5, 0x23}, {0x30F6, 0x23}, {0x30FB, 0x22}, {0x31F0, 0x23},
58 {0x31F1, 0x23}, {0x31F2, 0x23}, {0x31F3, 0x23}, {0x31F4, 0x23},
59 {0x31F5, 0x23}, {0x31F6, 0x23}, {0x31F7, 0x23}, {0x31F8, 0x23},
60 {0x31F9, 0x23}, {0x31FA, 0x23}, {0x31FB, 0x23}, {0x31FC, 0x23},
61 {0x31FD, 0x23}, {0x31FE, 0x23}, {0x31FF, 0x23},
62 };
63 const FX_JAPCHARPROPERTYEX* FX_GetJapCharPropertyEx(FX_WCHAR wch) {
64 int32_t iStart = 0;
65 int32_t iEnd =
66 sizeof(gs_FX_JapCharPropertysEx) / sizeof(FX_JAPCHARPROPERTYEX);
67 while (iStart <= iEnd) {
68 int32_t iMid = (iStart + iEnd) / 2;
69 FX_WCHAR wJapChar = gs_FX_JapCharPropertysEx[iMid].wChar;
70 if (wch == wJapChar) {
71 return gs_FX_JapCharPropertysEx + iMid;
72 } else if (wch < wJapChar) {
73 iEnd = iMid - 1;
74 } else {
75 iStart = iMid + 1;
76 }
77 }
78 return NULL;
79 }
80 FX_BOOL FX_AdjustJapCharDisplayPos(FX_WCHAR wch,
81 FX_BOOL bMBCSCode,
82 IFX_Font* pFont,
83 FX_FLOAT fFontSize,
84 FX_BOOL bVertical,
85 CFX_PointF& ptOffset) {
86 if (pFont == NULL || !bVertical) {
87 return FALSE;
88 }
89 if (wch < 0x3001 || wch > 0x31FF) {
90 return FALSE;
91 }
92 const FX_JAPCHARPROPERTYEX* pJapChar = FX_GetJapCharPropertyEx(wch);
93 if (pJapChar == NULL) {
94 return FALSE;
95 }
96 CFX_Rect rtBBox;
97 rtBBox.Reset();
98 if (pFont->GetCharBBox(wch, rtBBox, bMBCSCode)) {
99 switch (pJapChar->uAlign & 0xF0) {
100 case FX_JAPCHARPROPERTYEX_Top:
101 ptOffset.y = fFontSize * (1000 - rtBBox.height) / 1200.0f;
102 break;
103 case FX_JAPCHARPROPERTYEX_Middle:
104 ptOffset.y = fFontSize * (1000 - rtBBox.height) / 6000.0f;
105 break;
106 }
107 switch (pJapChar->uAlign & 0x0F) {
108 case FX_JAPCHARPROPERTYEX_Center:
109 ptOffset.x = fFontSize * (600 - rtBBox.right()) / 1000.0f;
110 break;
111 case FX_JAPCHARPROPERTYEX_Right:
112 ptOffset.x = fFontSize * (950 - rtBBox.right()) / 1000.0f;
113 break;
114 }
115 }
116 return TRUE;
117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698