Bugzilla – Attachment 77964 Details for
Bug 62846
Incorrect glyph to Unicode mappings in PDFs (Graphite)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Send attempt at a patch. Supercedes previous patches.
glyphs.patch (text/plain), 6.67 KB, created by
Jonathan
on 2013-04-15 00:32:50 UTC
(
hide
)
Description:
Send attempt at a patch. Supercedes previous patches.
Filename:
MIME Type:
Creator:
Jonathan
Created:
2013-04-15 00:32:50 UTC
Size:
6.67 KB
patch
obsolete
>diff --git a/vcl/aqua/source/gdi/atsui/salatslayout.cxx b/vcl/aqua/source/gdi/atsui/salatslayout.cxx >index b2f6a04..c4dc968 100644 >--- a/vcl/aqua/source/gdi/atsui/salatslayout.cxx >+++ b/vcl/aqua/source/gdi/atsui/salatslayout.cxx >@@ -609,6 +609,17 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int > break; > } > >+ // update returned index-into-string array >+ if( pCharIndexes ) >+ { >+ int nCharPos; >+ if( mpGlyphs2Chars ) >+ nCharPos = mpGlyphs2Chars[nStart]; >+ else >+ nCharPos = nStart + mnMinCharPos; >+ *(pCharIndexes++) = nCharPos; >+ } >+ > return nCount; > } > >diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx >index d435630..5682bbf 100644 >--- a/vcl/coretext/salcoretextlayout.cxx >+++ b/vcl/coretext/salcoretextlayout.cxx >@@ -402,6 +402,10 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos > nStart += 1; > } > >+ if( pCharIndexes ) { >+ pCharIndexes[i] = mpGlyphs2Chars[mnCurrentGlyphIndex]; >+ } >+ > SAL_INFO( "vcl.coretext.layout", "GetNextGlyphs() returning " << i ); > > return i; >diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx >index 4149e41..2781ab9 100644 >--- a/vcl/generic/print/genpspgraphics.cxx >+++ b/vcl/generic/print/genpspgraphics.cxx >@@ -733,7 +733,7 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx > sal_Int32 aWidthAry[ nMaxGlyphs ]; > sal_Int32 aIdxAry [ nMaxGlyphs ]; > sal_Unicode aUnicodes[ nMaxGlyphs ]; >- int aCharPosAry [ nMaxGlyphs ]; >+ int aCharPosAry [ nMaxGlyphs+1 ]; > > Point aPos; > long nUnitsPerPixel = rLayout.GetUnitsPerPixel(); >diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx >index 70ccd94..19238f4 100644 >--- a/vcl/source/gdi/pdfwriter_impl.cxx >+++ b/vcl/source/gdi/pdfwriter_impl.cxx >@@ -7623,7 +7623,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT > std::vector<sal_Ucs> aUnicodes; > aUnicodes.reserve( nMaxGlyphs ); > sal_Int32 pUnicodesPerGlyph[nMaxGlyphs]; >- int pCharPosAry[nMaxGlyphs]; >+ int pCharPosAry[nMaxGlyphs+1]; > sal_Int32 nAdvanceWidths[nMaxGlyphs]; > const PhysicalFontFace* pFallbackFonts[nMaxGlyphs]; > bool bVertical = m_aCurrentPDFState.m_aFont.IsVertical(); >@@ -7772,14 +7772,14 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT > aUnicodes.push_back( rText.GetChar( sal::static_int_cast<xub_StrLen>(pCharPosAry[i]) ) ); > pUnicodesPerGlyph[i] = 1; > // try to handle ligatures and such >- if( i < nGlyphs-1 ) >+ if( i < nGlyphs ) > { >- nChars = pCharPosAry[i+1] - pCharPosAry[i]; >+ nChars = pCharPosAry[i+1] - pCharPosAry[i]; > // #i115618# fix for simple RTL+CTL cases > // TODO: sanitize for RTL ligatures, more complex CTL, etc. > if( nChars < 0 ) > nChars = -nChars; >- else if( nChars == 0 ) >+ else if( nChars == 0 ) > nChars = 1; > pUnicodesPerGlyph[i] = nChars; > for( int n = 1; n < nChars; n++ ) >diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx >index 9df49c4..15e2ff7 100644 >--- a/vcl/source/gdi/sallayout.cxx >+++ b/vcl/source/gdi/sallayout.cxx >@@ -1347,8 +1347,12 @@ int GenericSalLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos > > nOldFlags = pG->mnGlyphIndex; // &GF_FLAGMASK not needed for test above > } >+ >+ // Calculate final pCharPosAry item >+ if( pCharPosAry ) >+ *pCharPosAry = pG->mnCharPos; > >- aRelativePos.X() /= mnUnitsPerPixel; >+ aRelativePos.X() /= mnUnitsPerPixel; > aRelativePos.Y() /= mnUnitsPerPixel; > rPos = GetDrawPosition( aRelativePos ); > >@@ -1596,7 +1600,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) > // prepare "merge sort" > int nStartOld[ MAX_FALLBACK ]; > int nStartNew[ MAX_FALLBACK ]; >- int nCharPos[ MAX_FALLBACK ]; >+ int nCharPos[ MAX_FALLBACK+1 ]; > sal_Int32 nGlyphAdv[ MAX_FALLBACK ]; > int nValid[ MAX_FALLBACK ] = {0}; > >diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx >index 6bebcf2..22479ea 100644 >--- a/vcl/source/glyphs/graphite_layout.cxx >+++ b/vcl/source/glyphs/graphite_layout.cxx >@@ -298,7 +298,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc > if (bCluster) > { > nBaseGlyphIndex = mvGlyphs.size(); >- mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset; >+// JS mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset; >+ mvGlyph2Char[nBaseGlyphIndex] = firstChar + mnSegCharOffset; > nFirstCharInCluster = firstChar; > nLastCharInCluster = lastChar; > } >@@ -1298,6 +1299,24 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, > if (glyph_itr->mnGlyphIndex == GF_DROPPED) > break; > } >+ >+ // Calculate final pCharPosAry item >+ if (char_index) >+ { >+ if (glyph_slot >= (signed)mvGlyph2Char.size()) >+ { >+ *char_index++ = mnMinCharPos + mvCharDxs.size(); >+ } >+ else >+ { >+ assert(glyph_slot > -1); >+ if (mvGlyph2Char[glyph_slot] == -1) >+ *char_index++ = mnMinCharPos + mvCharDxs.size(); >+ else >+ *char_index++ = mvGlyph2Char[glyph_slot]; >+ } >+ } >+ > int numGlyphs = glyph_slot - glyph_slot_begin; > // move the next glyph_slot to a glyph that hasn't been dropped > while (glyph_slot < static_cast<int>(mvGlyphs.size()) && >diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx >index 83bb2c3..b8ec80b 100644 >--- a/vcl/win/source/gdi/winlayout.cxx >+++ b/vcl/win/source/gdi/winlayout.cxx >@@ -597,6 +597,16 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, > break; > } > >+ if( pCharIndexes ) >+ { >+ int nCharPos; >+ if( !mpGlyphs2Chars ) >+ nCharPos = nStart + mnMinCharPos; >+ else >+ nCharPos = mpGlyphs2Chars[nStart]; >+ *(pCharIndexes++) = nCharPos; >+ } >+ > return nCount; > } > >@@ -1885,6 +1895,10 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, > > ++nStart; > nStartx8 = (nStart << 8) + nSubIter; >+ >+ if( pCharPosAry ) >+ *(pCharPosAry++) = nCharPos; >+ > return nCount; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62846
:
77143
|
77144
|
77575
| 77964 |
77996
|
77997
|
115088
|
115108
|
136057
|
136058