summaryrefslogtreecommitdiff
path: root/emfio/source
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-09-27 06:53:47 +0200
committerHossein <hossein@libreoffice.org>2021-09-27 22:08:15 +0200
commit5e4e1cdb1e14354b42838e1dfcf82873b3071896 (patch)
treef1d10dbf6d1f9ad302c6b505e1c5ed126fcce635 /emfio/source
parentfc5856263439846c9e692e1ccaddf3312530b1a2 (diff)
tdf#88163 Fix font size for placeable wmf files
The problems in tdf#88163 can be categorized into two parts, as described in d25906087918c085239aac30fd72cb65aa7b9eb4: First, the problem with the wmf files without the placeable header. Second, the problem with the wmf files with the placeable header. The above mentioned patch fixed the first part, and this patch fixes the second part. The problem was that upon seeing 22-byte placeable header, the records related to the size of the wmf like META_SETWINDOWORG (0x20b) and META_SETWINDOWEXT (0x20c) and others were ignored. These records were read in WmfReader::GetPlaceableBound() for the wmf files without placeable header. Adding this method for the wmf files with placeable header fixed the wrong calculation of bounds, which previously lead to wrong size of text. It should be noted that the scale in the placeable header is used, but the bounds are ignored for now. A new test named testTdf88163PlaceableWmf() is added that can be checked with: make CPPUNIT_TEST_NAME="testTdf88163PlaceableWmf" -sr \ CppunitTest_emfio_wmf Change-Id: I820c2e5922972cb5d555d98ef70c7581cd9f02d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122095 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/source')
-rw-r--r--emfio/source/reader/wmfreader.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index 00542fa9acf7..2567ca4939cf 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -1420,6 +1420,7 @@ namespace emfio
mpInputStream->SeekRel(2);
// BoundRect
+ // These are simply ignored for now
mpInputStream->ReadInt16( nVal );
aPlaceableBound.SetLeft( nVal );
mpInputStream->ReadInt16( nVal );
@@ -1437,9 +1438,16 @@ namespace emfio
// Skip and don't check the checksum
mpInputStream->SeekRel( 2 );
+
+ // Skip wmf header
+ mpInputStream->Seek( nStrmPos + 40 ); // set the streampos to the start of the metaactions
+ GetPlaceableBound( aPlaceableBound, mpInputStream );
+ // Go back to the place after placeable header
+ mpInputStream->Seek( nStrmPos + 22);
}
else
{
+ // Default is 1440, but it is set to 96 to show the wmf larger
mnUnitsPerInch = 96;
if (mpExternalHeader != nullptr