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

Side by Side Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 816153002: Transform font size to user space for valid text size comparison. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../include/fpdfapi/fpdf_resource.h" 7 #include "../../include/fpdfapi/fpdf_resource.h"
8 #include "../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../include/fpdftext/fpdf_text.h" 9 #include "../../include/fpdftext/fpdf_text.h"
10 #include "../../include/fpdfapi/fpdf_page.h" 10 #include "../../include/fpdfapi/fpdf_page.h"
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 charinfo.m_Matrix.Copy(matrix); 1837 charinfo.m_Matrix.Copy(matrix);
1838 if (wstrItem.IsEmpty()) { 1838 if (wstrItem.IsEmpty()) {
1839 charinfo.m_Unicode = 0; 1839 charinfo.m_Unicode = 0;
1840 m_TempCharList.Add(charinfo); 1840 m_TempCharList.Add(charinfo);
1841 m_TempTextBuf.AppendChar(0xfffe); 1841 m_TempTextBuf.AppendChar(0xfffe);
1842 continue; 1842 continue;
1843 } else { 1843 } else {
1844 int nTotal = wstrItem.GetLength(); 1844 int nTotal = wstrItem.GetLength();
1845 FX_BOOL bDel = FALSE; 1845 FX_BOOL bDel = FALSE;
1846 const int count = std::min(m_TempCharList.GetSize(), 7); 1846 const int count = std::min(m_TempCharList.GetSize(), 7);
1847 FX_FLOAT threshold = charinfo.m_Matrix.TransformXDistance((FX_FLOAT) TEXT_CHARRATIO_GAPDELTA*pTextObj->GetFontSize());
Lei Zhang 2014/12/20 00:55:26 nit: add spaces around '*'
1847 for (int n = m_TempCharList.GetSize(); 1848 for (int n = m_TempCharList.GetSize();
1848 n > m_TempCharList.GetSize() - count; 1849 n > m_TempCharList.GetSize() - count;
1849 n--) { 1850 n--) {
1850 PAGECHAR_INFO* charinfo1 = (PAGECHAR_INFO*)m_TempCharList.GetAt( n - 1); 1851 PAGECHAR_INFO* charinfo1 = (PAGECHAR_INFO*)m_TempCharList.GetAt( n - 1);
1851 if(charinfo1->m_CharCode == charinfo.m_CharCode && 1852 if(charinfo1->m_CharCode == charinfo.m_CharCode &&
1852 charinfo1->m_pTextObj->GetFont() == charinfo.m_pTextObj- >GetFont() && 1853 charinfo1->m_pTextObj->GetFont() == charinfo.m_pTextObj- >GetFont() &&
1853 FXSYS_fabs(charinfo1->m_OriginX - charinfo.m_OriginX) < TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize() && 1854 FXSYS_fabs(charinfo1->m_OriginX - charinfo.m_OriginX) < threshold &&
1854 FXSYS_fabs(charinfo1->m_OriginY - charinfo.m_OriginY) < TEXT_CHARRATIO_GAPDELTA * pTextObj->GetFontSize() ) { 1855 FXSYS_fabs(charinfo1->m_OriginY - charinfo.m_OriginY) < threshold) {
1855 bDel = TRUE; 1856 bDel = TRUE;
1856 break; 1857 break;
1857 } 1858 }
1858 } 1859 }
1859 if(!bDel) { 1860 if(!bDel) {
1860 for (int nIndex = 0; nIndex < nTotal; nIndex++) { 1861 for (int nIndex = 0; nIndex < nTotal; nIndex++) {
1861 charinfo.m_Unicode = wstrItem.GetAt(nIndex); 1862 charinfo.m_Unicode = wstrItem.GetAt(nIndex);
1862 if (charinfo.m_Unicode) { 1863 if (charinfo.m_Unicode) {
1863 charinfo.m_Index = m_TextBuf.GetLength(); 1864 charinfo.m_Index = m_TextBuf.GetLength();
1864 m_TempTextBuf.AppendChar(charinfo.m_Unicode); 1865 m_TempTextBuf.AppendChar(charinfo.m_Unicode);
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { 2840 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) {
2840 return; 2841 return;
2841 } 2842 }
2842 CPDF_LinkExt* link = NULL; 2843 CPDF_LinkExt* link = NULL;
2843 link = m_LinkList.GetAt(index); 2844 link = m_LinkList.GetAt(index);
2844 if (!link) { 2845 if (!link) {
2845 return ; 2846 return ;
2846 } 2847 }
2847 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); 2848 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects);
2848 } 2849 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698