From 97b70d20bbd266d627a402360b0fd682f53355a3 Mon Sep 17 00:00:00 2001
From: Shin Sang-jae <codelabor@gmail.com>
Date: Sat, 28 Nov 2020 02:11:40 +0900
Subject: [PATCH] EPUB: use preserveAspectRatio="xMidYMid" for cover image
 (#6895)

This change affects both the epub2 and the epub3 templates.
It avoids distortion of the cover image by requiring that the aspect ratio be preserved.
---
 data/templates/default.epub2 | 2 +-
 data/templates/default.epub3 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/data/templates/default.epub2 b/data/templates/default.epub2
index f440134df..685d10208 100644
--- a/data/templates/default.epub2
+++ b/data/templates/default.epub2
@@ -48,7 +48,7 @@ $endif$
 $else$
 $if(coverpage)$
 <div id="cover-image">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="none">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="xMidYMid">
 <image width="$cover-image-width$" height="$cover-image-height$" xlink:href="../media/$cover-image$" />
 </svg>
 </div>
diff --git a/data/templates/default.epub3 b/data/templates/default.epub3
index 4f5bd6641..fc4fa7620 100644
--- a/data/templates/default.epub3
+++ b/data/templates/default.epub3
@@ -49,7 +49,7 @@ $endif$
 $else$
 $if(coverpage)$
 <div id="cover-image">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="none">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="xMidYMid">
 <image width="$cover-image-width$" height="$cover-image-height$" xlink:href="../media/$cover-image$" />
 </svg>
 </div>