| OLD | NEW |
| 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 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
| 7 /* | 7 /* |
| 8 * Copyright 2011 ZXing authors | 8 * Copyright 2011 ZXing authors |
| 9 * | 9 * |
| 10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, | 126 void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, |
| 127 FXTEXT_CHARPOS* charPos, | 127 FXTEXT_CHARPOS* charPos, |
| 128 CFX_Font* cFont, | 128 CFX_Font* cFont, |
| 129 FX_FLOAT geWidth, | 129 FX_FLOAT geWidth, |
| 130 int32_t fontSize, | 130 int32_t fontSize, |
| 131 FX_FLOAT& charsLen) { | 131 FX_FLOAT& charsLen) { |
| 132 std::unique_ptr<CFX_UnicodeEncodingEx> encoding( | 132 std::unique_ptr<CFX_UnicodeEncodingEx> encoding( |
| 133 FX_CreateFontEncodingEx(cFont)); | 133 FX_CreateFontEncodingEx(cFont)); |
| 134 | 134 |
| 135 int32_t length = text.GetLength(); | 135 int32_t length = text.GetLength(); |
| 136 FX_DWORD* pCharCode = FX_Alloc(FX_DWORD, text.GetLength()); | 136 uint32_t* pCharCode = FX_Alloc(uint32_t, text.GetLength()); |
| 137 FX_FLOAT charWidth = 0; | 137 FX_FLOAT charWidth = 0; |
| 138 for (int32_t j = 0; j < text.GetLength(); j++) { | 138 for (int32_t j = 0; j < text.GetLength(); j++) { |
| 139 pCharCode[j] = encoding->CharCodeFromUnicode(text[j]); | 139 pCharCode[j] = encoding->CharCodeFromUnicode(text[j]); |
| 140 int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]); | 140 int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]); |
| 141 int32_t glyp_value = cFont->GetGlyphWidth(glyp_code); | 141 int32_t glyp_value = cFont->GetGlyphWidth(glyp_code); |
| 142 FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0); | 142 FX_FLOAT temp = (FX_FLOAT)((glyp_value)*fontSize / 1000.0); |
| 143 charWidth += temp; | 143 charWidth += temp; |
| 144 } | 144 } |
| 145 charsLen = charWidth; | 145 charsLen = charWidth; |
| 146 FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f; | 146 FX_FLOAT leftPositon = (FX_FLOAT)(geWidth - charsLen) / 2.0f; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { | 428 if (outputX + m_multiple > outputWidth && outputWidth - outputX > 0) { |
| 429 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); | 429 m_output->SetRegion(outputX, 0, outputWidth - outputX, outputHeight, e); |
| 430 break; | 430 break; |
| 431 } | 431 } |
| 432 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); | 432 m_output->SetRegion(outputX, 0, m_multiple, outputHeight, e); |
| 433 BC_EXCEPTION_CHECK_ReturnVoid(e); | 433 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 434 } | 434 } |
| 435 outputX += m_multiple; | 435 outputX += m_multiple; |
| 436 } | 436 } |
| 437 } | 437 } |
| OLD | NEW |