sw: Write only val attribute for charset
Office only writes characterSet attribute for charset to word/fontTable.xml if file is strict OOXML, which LO doesn't support anyway. Commitae8530c5b7added conditional export of characterSet depending on OOXML version, sometimes exporting both characterSet and val. OOXML validator complains about this: {"Description":"The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:characterSet' has invalid value 'windows-1252'. The Enumeration constraint failed.","Path":{"Namespaces":{},"XPath": "/w:fonts[1]/w:font[1]/w:charset[1]", "PartUri":"/word/fontTable.xml"}, "Id":"Sch_AttributeValueDataTypeDetailed","ErrorType":"Schema"} This reverts commitae8530c5b7. Change-Id: Ic1fdb46724a2a8713286d02b65d6a052e207e8c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202471 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -7760,22 +7760,15 @@ void DocxAttributeOutput::FontAlternateName( const OUString& rName ) const
|
||||
m_pSerializer->singleElementNS(XML_w, XML_altName, FSNS(XML_w, XML_val), rName);
|
||||
}
|
||||
|
||||
void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const
|
||||
void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet ) const
|
||||
{
|
||||
rtl::Reference<FastAttributeList> pAttr = FastSerializerHelper::createAttrList();
|
||||
|
||||
OString aCharSet( OString::number( nCharSet, 16 ) );
|
||||
if ( aCharSet.getLength() == 1 )
|
||||
aCharSet = "0" + aCharSet;
|
||||
pAttr->add(FSNS(XML_w, XML_val), aCharSet);
|
||||
|
||||
if (GetExport().GetFilter().getVersion() != oox::core::ECMA_376_1ST_EDITION)
|
||||
{
|
||||
if( const char* charset = rtl_getMimeCharsetFromTextEncoding( nEncoding ))
|
||||
pAttr->add( FSNS( XML_w, XML_characterSet ), charset );
|
||||
}
|
||||
|
||||
m_pSerializer->singleElementNS( XML_w, XML_charset, pAttr );
|
||||
// An old change also added w:characterSet to the export conditionally, but it's only for
|
||||
// strict OOXML that LO doesn't support and the condition couldn't cover, so it's removed now
|
||||
m_pSerializer->singleElementNS( XML_w, XML_charset, FSNS(XML_w, XML_val), aCharSet );
|
||||
}
|
||||
|
||||
void DocxAttributeOutput::FontFamilyType( FontFamily eFamily ) const
|
||||
|
||||
@@ -409,7 +409,7 @@ public:
|
||||
void FontAlternateName( const OUString& rName ) const;
|
||||
|
||||
/// Font charset.
|
||||
void FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const;
|
||||
void FontCharset( sal_uInt8 nCharSet ) const;
|
||||
|
||||
/// Font family.
|
||||
void FontFamilyType( FontFamily eFamily ) const;
|
||||
|
||||
@@ -875,7 +875,7 @@ void wwFont::WriteDocx( DocxAttributeOutput* rAttrOutput ) const
|
||||
|
||||
if ( mbAlt )
|
||||
rAttrOutput->FontAlternateName( msAltNm );
|
||||
rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ), meChrSet );
|
||||
rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ) );
|
||||
rAttrOutput->FontFamilyType( meFamily );
|
||||
rAttrOutput->FontPitchType( mePitch );
|
||||
rAttrOutput->EmbedFont( msFamilyNm, meFamily, mePitch );
|
||||
|
||||
Reference in New Issue
Block a user