asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Inline images are displayed more than once when alt text uses fallback font #1858

Closed ggenzone closed 3 years ago

ggenzone commented 3 years ago

Hi I found a problem using the image macro with 'default-with-fallback-font' theme and some alt text using CJK symbols.

Images are displayed more than once.

An example

Using the following file:

= Example

image:example.png[チのデータレプリケーションです。]

Image:

diagram_cloud_manager_overview

Command

asciidoctor-pdf -a pdf-theme=default-with-fallback-font example.adoc

Result

example.pdf

More info

# asciidoctor-pdf -v
Asciidoctor PDF 1.5.3 using Asciidoctor 2.0.12 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

Am I doing something wrong?

It seems to be related with this line

mojavelinux commented 3 years ago

You're correct that the consultation of the fallback font for alt text is interfering with the rendering of inline images. It's probably calling the image arranger multiple times.

In the meantime, you can fix it by using a block image. See https://docs.asciidoctor.org/asciidoc/latest/macros/images/#block-image-macro

mojavelinux commented 3 years ago

Indeed, when the image fragment is divided up to use the fallback font, this causes the image to be rendered multiple times. I have a fix for it.

ggenzone commented 3 years ago

Great, thank you!!