Skip to content

Commit

Permalink
Add width and height attributes to the files with EA patch applied (#34)
Browse files Browse the repository at this point in the history
* Force width and height attributes

* Change CI scripts to build outside of source tree

* Update status badges
  • Loading branch information
maxirmx authored Apr 21, 2022
1 parent e2aa214 commit 792609a
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 62 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/alpine-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- name: Create cache storage and cache key
run: |
mkdir ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
git config --global --add safe.directory $(pwd)
git submodule status > sm.txt
- name: Process cache
Expand All @@ -61,10 +62,14 @@ jobs:

- name: Configure CMake
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Test well formed files
run: ./tests/resources/check_correctness.sh -r -s
Expand Down Expand Up @@ -100,6 +105,7 @@ jobs:
- name: Create cache storage and cache key
run: |
mkdir ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
git config --global --add safe.directory /__w/libemf2svg/libemf2svg
git submodule status > sm.txt
- name: Process cache
Expand All @@ -110,13 +116,17 @@ jobs:

- name: Configure CMake
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Checkout shell test framework
uses: actions/checkout@v3
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ jobs:

- name: Configure CMake
run: |
cmake -B ${{ github.workspace }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DVCPKG_TARGET_TRIPLET=arm64-osx \
-DLONLY=ON \
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DVCPKG_TARGET_TRIPLET=arm64-osx \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build ${{github.workspace}} --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Checkout shell test framework
uses: actions/checkout@v3
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ jobs:
brew install --HEAD LouisBrunner/valgrind/valgrind
- name: Configure CMake
run: cmake -B ${{ github.workspace }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build ${{ github.workspace }} --config ${{ env.BUILD_TYPE }}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Test well formed files
working-directory: ${{ github.workspace }}
Expand Down Expand Up @@ -79,14 +85,17 @@ jobs:

- name: Configure CMake
run: |
cmake -B ${{ github.workspace }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DVCPKG_TARGET_TRIPLET=x64-osx \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DVCPKG_TARGET_TRIPLET=x64-osx \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build ${{github.workspace}} --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Checkout shell test framework
uses: actions/checkout@v3
Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/msys-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,21 @@ jobs:

- name: Configure
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Smoke test
run: |
./emf2svg-conv.exe --version
./emf2svg-conv.exe -i tests/resources/emf/test-000.emf -o test-000.svg
./build/emf2svg-conv.exe --version
./build/emf2svg-conv.exe -i tests/resources/emf/test-000.emf -o test-000.svg
ls | grep test-000.svg
build-for-ruby:
Expand Down Expand Up @@ -119,13 +123,17 @@ jobs:

- name: Configure
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Checkout shell test framework
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
rm -rf libemf2svg/vcpkg/.git*
rm -rf libemf2svg/tests
tar cvzf libemf2svg.tar.gz libemf2svg
sha256sum libemf2svg.tar.gz > libemf2svg.tar.gz.sha256
sha256sum -b libemf2svg.tar.gz > libemf2svg.tar.gz.sha256
- name: Release
uses: softprops/action-gh-release@v1
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/ubuntu-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,20 @@ jobs:
- name: Configure CMake
run: |
cmake -B ${{ github.workspace }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=arm64-linux
- name: Build
run: cmake --build ${{ github.workspace }} --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Smoke test
run: |
qemu-aarch64 -L /usr/aarch64-linux-gnu ${{ github.workspace }}/emf2svg-conv --version
qemu-aarch64 -L /usr/aarch64-linux-gnu ${{ github.workspace }}/emf2svg-conv \
qemu-aarch64 -L /usr/aarch64-linux-gnu ${{ github.workspace }}/build/emf2svg-conv --version
qemu-aarch64 -L /usr/aarch64-linux-gnu ${{ github.workspace }}/build/emf2svg-conv \
-i ${{ github.workspace }}/tests/resources/emf/test-000.emf -o test-000.svg
ls | grep test-000.svg
32 changes: 23 additions & 9 deletions .github/workflows/ubuntu-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ jobs:
sudo apt-get install libxml2-utils valgrind
- name: Configure CMake
run: cmake -B ${{ github.workspace }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build ${{ github.workspace }} --config ${{env.BUILD_TYPE }}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE }}
- name: Test well formed files
working-directory: ${{ github.workspace }}
Expand Down Expand Up @@ -61,10 +66,15 @@ jobs:
run: sudo pip install cpp-coveralls

- name: Configure CMake
run: cmake -B ${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DGCOV=ON
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DGCOV=ON
- name: Build
run: make coverage
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Report
run: |
Expand Down Expand Up @@ -104,13 +114,17 @@ jobs:

- name: Configure CMake
run: |
cmake -B . -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DLONLY=ON \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build . --config ${{env.BUILD_TYPE}}
run: |
cd build
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Checkout shell test framework
uses: actions/checkout@v3
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/windows-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ jobs:
key: ${{ github.workflow }}-vcpkg-${{ hashFiles('sm.txt') }}

- name: Configure
run: >
cmake
-B ${{ github.workspace }}
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
run: cmake -B . -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake

- name: Build
run: cmake --build ${{ github.workspace }} --config ${{env.BUILD_TYPE}}
run: cmake --build . --config ${{env.BUILD_TYPE}}

- name: Smoke test
run: |
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ project (emf2svg)

set(emf2svg_VERSION_MAJOR 1)
set(emf2svg_VERSION_MINOR 7)
set(emf2svg_VERSION_PATCH 0)
set(emf2svg_VERSION_PATCH 1)
set(emf2svg_VERSION ${emf2svg_VERSION_MAJOR}.${emf2svg_VERSION_MINOR}.${emf2svg_VERSION_PATCH})

if(VCPKG_TARGET_TRIPLET)
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
libemf2svg
==========
[![Ubuntu-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml) [![Ubuntu-aarch64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml) [![Alpine-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml)
[![Ubuntu-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-x86_64.yml) [![Ubuntu-aarch64](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/ubuntu-aarch64.yml) [![Alpine-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/alpine-x86_64.yml)

[![MacOS-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml) [![MacOS-arm64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml) [![Windows-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml) [![MSys-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml/badge.svg)](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml)
[![MacOS-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-x86_64.yml) [![MacOS-arm64](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/macos-arm64.yml) [![Windows-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/windows-x86_64.yml) [![MSys-x86_64](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml/badge.svg?branch=master)](https://github.com/metanorma/libemf2svg/actions/workflows/msys-x86_64.yml)

[![Coverage Status](https://coveralls.io/repos/github/metanorma/libemf2svg/badge.svg?branch=master)](https://coveralls.io/github/metanorma/libemf2svg?branch=master)

Expand Down Expand Up @@ -231,9 +231,13 @@ EMF+ RECORDS:
ChangeLogs
----------

1.7.1:

* added width and heigt attributes for svg even when Y-coordinates are repaired

1.7.0:

* refactor build scripts to facilitate better portability and ruby integration
* refactor build scripts to facilitate better portability and ruby integration

1.6.0:

Expand Down
8 changes: 5 additions & 3 deletions src/lib/emf2svg_rec_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ void U_EMRHEADER_draw(const char *contents, FILE *out, drawingStates *states) {
fprintf(out, "xmlns:%s=\"http://www.w3.org/2000/svg\"",
states->nameSpace);
}

// https://www.w3.org/TR/SVG2/coords.html
if (states->fixBrokenYTransform) {
fprintf(out, ">\n");
fprintf(out, "<%sg transform=\"translate(0.0000, 0.0000)\">\n",
fprintf(out, " width=\"%.4f\" height=\"%.4f\">\n",
states->imgWidth + 1,
states->imgHeight + 1);
fprintf(out, "<%sg transform=\"translate(0.0000, 0.00 00)\">\n",
states->nameSpaceString);
} else {
fprintf(out, " width=\"%.4f\" height=\"%.4f\">\n", states->imgWidth,
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/check_correctness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cd $ABSPATH
. ./colors.sh
rm -rf $OUTDIR
mkdir -p $OUTDIR
CMD="`$RL -f ../../emf2svg-conv`"
CMD="`$RL -f ../../build/emf2svg-conv`"
OUTDIR=`$RL -f $OUTDIR`
DTD=`$RL -f ./svg11-flat.dtd`
for emf in `find $EMFDIR -type f -name "*.emf" |sort`
Expand Down
Binary file added tests/resources/emf-ea/EA-test-file-101.emf
Binary file not shown.
Binary file added tests/resources/emf-ea/EA-test-file-102.emf
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/resources/lcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ DIR_ROOT="$( cd "$DIR1" && pwd )"
DIR_TESTS="$( cd "$DIR0/.." && pwd)"

echo "Running libemf2svg linkage tests"
probe="$DIR_ROOT/libemf2svg"
probe="$DIR_ROOT/build/libemf2svg"
# shellcheck source=/dev/null
. "$DIR_TESTS"/shunit2/shunit2
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libemf2svg",
"version-string": "1.7.0",
"version-string": "1.7.1",
"dependencies": [
"libxml2",
"libpng",
Expand Down

0 comments on commit 792609a

Please sign in to comment.