sw/source/core/text/EnhancedPDFExportHelper.cxx | 11 +++++++++-- sw/source/core/text/txthyph.cxx | 12 ++---------- 2 files changed, 11 insertions(+), 12 deletions(-)
New commits: commit 158027cd7fe1ea2faeb5d2220547b36c9cbfb9d3 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Dec 22 01:02:19 2013 +0200 fdo#67370: Hyphens are not visible in tagged PDF One requirement of tagged PDF is to represent automatically inserted hyphens using the soft hyphen (U+00AD) character, so we were doing this by simply passing that character to text layout code when exporting a tagged PDF (which is the literal suggestion of old PDF specification). This is wrong, though, since the soft hyphen is a control character and should not have a visible output by itself (and fonts might not even have a visible glyph there), but this happened to work because non of the layout engines we are using treated soft hyphen specially and was just showing whatever glyph the font had there. This broke with the switch to HarfBuzz since it will not show any visible glyph for Unicode control characters (by default), which is the right thing to do. Latest versions of PDF spec suggest using either ToUnicode mapping or an ActualText text entry to encode the soft hyphen instead, I found it easier to use ActualText since we already have code that handles non-standard hyphenation using it already. Conflicts: sw/source/core/text/EnhancedPDFExportHelper.cxx sw/source/core/text/txthyph.cxx Change-Id: I88deadf3a806f69775b2e0ccff2f9b2f61a0f2e2 Reviewed-on: https://gerrit.libreoffice.org/7177 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 3933837..9538de6 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -766,7 +766,8 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) case vcl::PDFWriter::Span : case vcl::PDFWriter::Quote : case vcl::PDFWriter::Code : - if( POR_HYPHSTR == pPor->GetWhichPor() || POR_SOFTHYPHSTR == pPor->GetWhichPor() ) + if( POR_HYPHSTR == pPor->GetWhichPor() || POR_SOFTHYPHSTR == pPor->GetWhichPor() || + POR_HYPH == pPor->GetWhichPor() || POR_SOFTHYPH == pPor->GetWhichPor() ) bActualText = true; else { @@ -789,7 +790,11 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bActualText ) { - const String aActualTxt( rInf.GetTxt(), rInf.GetIdx(), pPor->GetLen() ); + String aActualTxt; + if (pPor->GetWhichPor() == POR_SOFTHYPH || pPor->GetWhichPor() == POR_HYPH) + aActualTxt = (sal_Unicode)0xad; // soft hyphen + else + aActualTxt = String(rInf.GetTxt(), rInf.GetIdx(), pPor->GetLen()); mpPDFExtOutDevData->SetActualText( aActualTxt ); } @@ -1373,6 +1378,8 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() switch ( pPor->GetWhichPor() ) { + case POR_HYPH : + case POR_SOFTHYPH : // Check for alternative spelling: case POR_HYPHSTR : case POR_SOFTHYPHSTR : diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index 62b3ad4..6b32a9f 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -20,7 +20,6 @@ #include <hintids.hxx> #include <editeng/unolingu.hxx> #include <com/sun/star/i18n/WordType.hpp> -#include <EnhancedPDFExportHelper.hxx> #include <viewopt.hxx> // SwViewOptions #include <viewsh.hxx> #include <SwPortionHandler.hxx> @@ -370,16 +369,9 @@ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ) * virtual SwHyphPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const +sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &/*rInf*/, OUString &rTxt ) const { - // #i16816# tagged pdf support - const sal_Unicode cChar = rInf.GetVsh() && - rInf.GetVsh()->GetViewOptions()->IsPDFExport() && - SwTaggedPDFHelper::IsExportTaggedPDF( *rInf.GetOut() ) ? - 0xad : - '-'; - - rTxt = OUString(cChar); + rTxt = "-"; return sal_True; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits