asciidoctor-pdf with custom style: problem with fonts

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

asciidoctor-pdf with custom style: problem with fonts

Siegfried Kurz
Hi,
I'm moving form asciidoc to asciidoctor-pdf and want to use a custom style for the pdf-output.

I get the following error when using my custom theme:
"The following text could not be fully converted to the Windows-1252 character set:"
Without the custom theme, no errors are generated.
From the source I see, that the error stems from an ellipsis ("…")

My command line is:
/usr/bin/asciidoctor-pdf -d book -b pdf -a title -a pdf-style=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml -o /u1/dcpa/etroot_entw/tmp/tmp.29374.pdf Noah.asc

What am I doing wrong?

best regards from germany
Siegfried
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

mojavelinux
Administrator
It sounds like you need to read this section:


The simplest way to deal with this now is to just extend the default theme and add your customizations.

extends: default
base:
  font-size: 333333
...

That way, you start with all the right fonts.

Cheers,

-Dan

On Tue, Jul 16, 2019 at 7:13 AM Siegfried Kurz [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,
I'm moving form asciidoc to asciidoctor-pdf and want to use a custom style for the pdf-output.

I get the following error when using my custom theme:
"The following text could not be fully converted to the Windows-1252 character set:"
Without the custom theme, no errors are generated.
From the source I see, that the error stems from an ellipsis ("…")

My command line is:
/usr/bin/asciidoctor-pdf -d book -b pdf -a title -a pdf-style=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml -o /u1/dcpa/etroot_entw/tmp/tmp.29374.pdf Noah.asc

What am I doing wrong?

best regards from germany
Siegfried


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-with-custom-style-problem-with-fonts-tp6992.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

Siegfried Kurz
Hello mojavelinux,
thanks for Your answer.
I tried to read the docs, but maybe not seriously enough ;)
But, unfortunately, your hint didn't help.

Here is my theme:
cat /usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml
extends: default
base:
    font-color: #FFFF00
heading:
    font-color: #24A0ED

When I uss this, I get the same error as in my first post.

When I try with added variable pdf-fontsdir
/usr/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-fontsdir=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/fonts -a pdf-theme=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml  -o /u1/dcpa/etroot_entw/tmp/tmp.17302.pdf Noah.asc
no errors are generated, but the output is unchanged, it seems to me, as the hit-theme.yml is been ignored.

ls -la /usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/fonts

-rw-r--r-- 1 root root     375 Mär  2  2017 LICENSE-mplus-testflight-58
-rw-r--r-- 1 root root   11357 Mär  2  2017 LICENSE-noto-2015-06-05
-rw-r--r-- 1 root root   15868 Mär  2  2017 mplus1mn-bold-ascii.ttf
-rw-r--r-- 1 root root   15908 Mär  2  2017 mplus1mn-bold_italic-ascii.ttf
-rw-r--r-- 1 root root   15928 Mär  2  2017 mplus1mn-italic-ascii.ttf
-rw-r--r-- 1 root root   20024 Mär  2  2017 mplus1mn-regular-ascii-conums.ttf
-rw-r--r-- 1 root root 1405716 Mär  2  2017 mplus1p-regular-fallback.ttf
-rw-r--r-- 1 root root  241436 Mär  2  2017 notoserif-bold_italic-subset.ttf
-rw-r--r-- 1 root root  228596 Mär  2  2017 notoserif-bold-subset.ttf
-rw-r--r-- 1 root root  214988 Mär  2  2017 notoserif-italic-subset.ttf
-rw-r--r-- 1 root root  227824 Mär  2  2017 notoserif-regular-subset.ttf

When I try this:
gem contents asciidoctor-pdf --show-install-dir
I get:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
invalid option: --show-install-dir
/usr/lib64/ruby/2.0.0/rubygems/command.rb:375:in `handle_options'
/usr/lib64/ruby/2.0.0/rubygems/command.rb:296:in `invoke_with_build_args'
/usr/lib64/ruby/2.0.0/rubygems/command_manager.rb:170:in `process_args'
/usr/lib64/ruby/2.0.0/rubygems/command_manager.rb:130:in `run'
/usr/lib64/ruby/2.0.0/rubygems/gem_runner.rb:60:in `run'
/usr/bin/gem:21:in `<main>'

/usr/bin/asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.alpha.14 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.0.0p247 (2013-06-27) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

best regards from germany
Siegfried



Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

mojavelinux
Administrator
The version of Asciidoctor PDF you're using is too old. Please upgrade to 1.5.0.beta.1. Support for the "extends" keyword isn't available in the version you are using.

Cheers,

-Dan

On Wed, Jul 17, 2019 at 2:36 AM Siegfried Kurz [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello mojavelinux,
thanks for Your answer.
I tried to read the docs, but maybe not seriously enough ;)
But, unfortunately, your hint didn't help.

Here is my theme:
cat /usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml
extends: default
base:
    font-color: #FFFF00
heading:
    font-color: #24A0ED

When I uss this, I get the same error as in my first post.

When I try with added variable pdf-fontsdir
/usr/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-fontsdir=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/fonts -a pdf-theme=/usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/themes/hit-theme.yml  -o /u1/dcpa/etroot_entw/tmp/tmp.17302.pdf Noah.asc
no errors are generated, but the output is unchanged, it seems to me, as the hit-theme.yml is been ignored.

ls -la /usr/lib64/ruby/gems/2.0.0/gems/asciidoctor-pdf-1.5.0.alpha.14/data/fonts

-rw-r--r-- 1 root root     375 Mär  2  2017 LICENSE-mplus-testflight-58
-rw-r--r-- 1 root root   11357 Mär  2  2017 LICENSE-noto-2015-06-05
-rw-r--r-- 1 root root   15868 Mär  2  2017 mplus1mn-bold-ascii.ttf
-rw-r--r-- 1 root root   15908 Mär  2  2017 mplus1mn-bold_italic-ascii.ttf
-rw-r--r-- 1 root root   15928 Mär  2  2017 mplus1mn-italic-ascii.ttf
-rw-r--r-- 1 root root   20024 Mär  2  2017 mplus1mn-regular-ascii-conums.ttf
-rw-r--r-- 1 root root 1405716 Mär  2  2017 mplus1p-regular-fallback.ttf
-rw-r--r-- 1 root root  241436 Mär  2  2017 notoserif-bold_italic-subset.ttf
-rw-r--r-- 1 root root  228596 Mär  2  2017 notoserif-bold-subset.ttf
-rw-r--r-- 1 root root  214988 Mär  2  2017 notoserif-italic-subset.ttf
-rw-r--r-- 1 root root  227824 Mär  2  2017 notoserif-regular-subset.ttf

When I try this:
gem contents asciidoctor-pdf --show-install-dir
I get:

ERROR:  While executing gem ... (OptionParser::InvalidOption)
invalid option: --show-install-dir
/usr/lib64/ruby/2.0.0/rubygems/command.rb:375:in `handle_options'
/usr/lib64/ruby/2.0.0/rubygems/command.rb:296:in `invoke_with_build_args'
/usr/lib64/ruby/2.0.0/rubygems/command_manager.rb:170:in `process_args'
/usr/lib64/ruby/2.0.0/rubygems/command_manager.rb:130:in `run'
/usr/lib64/ruby/2.0.0/rubygems/gem_runner.rb:60:in `run'
/usr/bin/gem:21:in `<main>'

/usr/bin/asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.alpha.14 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.0.0p247 (2013-06-27) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

best regards from germany
Siegfried






If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-with-custom-style-problem-with-fonts-tp6992p6994.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

Siegfried Kurz
Hello Dan,
so I've upgraded asciidoctor-pdf to 1.5.0.beta.1, which is installed into /usr/local/bin/asciidoctor-pdf

/usr/local/bin/asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.beta.1 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

gem contents asciidoctor-pdf --show-install-dir
now results in:
/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1

cat /usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/themes/hit-theme.yml
extends: default
heading:
   font-color: #0066CC

ls -la  /usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/fonts

-rwxrwxrwx 1 root root     375 Jul 17 14:07 LICENSE-mplus-testflight-58*
-rwxrwxrwx 1 root root   11357 Jul 17 14:07 LICENSE-noto-2015-06-05*
-rwxrwxrwx 1 root root   15868 Jul 17 14:07 mplus1mn-bold-ascii.ttf*
-rwxrwxrwx 1 root root   15908 Jul 17 14:07 mplus1mn-bold_italic-ascii.ttf*
-rwxrwxrwx 1 root root   15928 Jul 17 14:07 mplus1mn-italic-ascii.ttf*
-rwxrwxrwx 1 root root   20024 Jul 17 14:07 mplus1mn-regular-ascii-conums.ttf*
-rwxrwxrwx 1 root root 1353324 Jul 17 14:07 mplus1p-regular-fallback.ttf*
-rwxrwxrwx 1 root root  234300 Jul 17 14:07 notoserif-bold_italic-subset.ttf*
-rwxrwxrwx 1 root root  221460 Jul 17 14:07 notoserif-bold-subset.ttf*
-rwxrwxrwx 1 root root  207852 Jul 17 14:07 notoserif-italic-subset.ttf*
-rwxrwxrwx 1 root root  220668 Jul 17 14:07 notoserif-regular-subset.ttf*

my commandline is:
/usr/local/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-fontsdir=/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/fonts -a pdf-style=/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/themes/hit-theme.yml  -o /u1/dcpa/etroot_entw/tmp/tmp.23867.pdf Noah.asc

with this commandline, no errors, but the theme hit-theme.yml is been ignored

I've tried also the commandline from the docs:
/usr/local/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-themesdir=resources/themes -a pdf-fontsdir=resources/fonts -a pdf-theme=hit  -o /u1/dcpa/etroot_entw/tmp/tmp.25190.pdf Noah.asc

here also, no errors, but the theme hit is been ignored

for this, I've copied the fonts and the theme into the file-structure from the docs-example:

cd <sourcedir>
find ./resources
./resources
./resources/fonts
./resources/fonts/mplus1p-regular-fallback.ttf
./resources/fonts/notoserif-bold_italic-subset.ttf
./resources/fonts/mplus1mn-bold_italic-ascii.ttf
./resources/fonts/mplus1mn-italic-ascii.ttf
./resources/fonts/notoserif-italic-subset.ttf
./resources/fonts/LICENSE-mplus-testflight-58
./resources/fonts/notoserif-regular-subset.ttf
./resources/fonts/LICENSE-noto-2015-06-05
./resources/fonts/mplus1mn-bold-ascii.ttf
./resources/fonts/mplus1mn-regular-ascii-conums.ttf
./resources/fonts/notoserif-bold-subset.ttf
./resources/themes
./resources/themes/hit-theme.yml

cat resources/themes/hit-theme.yml
extends: default
heading:
   font-color: #0066CC


best regards from germany
Siegfried



Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

mojavelinux
Administrator
Siegfried,

Please don't install the gem into the system. That's just going to lead to complications. Use something like RVM or Bundler to manage the gem inside your home directory or inside your project. And you definitely shouldn't be adding a custom theme to the gem's installation directory. That's not how the gem was designed to work.

This command is more correct:

/usr/local/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-themesdir=resources/themes -a pdf-fontsdir=resources/fonts -a pdf-theme=hit  -o /u1/dcpa/etroot_entw/tmp/tmp.25190.pdf Noah.asc

Except a few things:

* Verify you are really running 1.5.0.beta.1 by using asciidoctor-pdf -v
* Prefix the pdf-themesdir value with ./
* You don't need to specify the pdf-fontsdir or copy the fonts if you are using the bundled fonts (they will be discovered automatically)
* Use .adoc as the AsciiDoc file extension (just a side note)

If you do those things, I'm confident it will work. But I still recommend using RVM or Bundler to manage the gem because installing into the system (anywhere outside of home) is going to be problematic (unless you can install from a Linux package, but you can't since it's too out of date).

Best,

-Dan

On Wed, Jul 17, 2019 at 7:17 AM Siegfried Kurz [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello Dan,
so I've upgraded asciidoctor-pdf to 1.5.0.beta.1, which is installed into /usr/local/bin/asciidoctor-pdf

/usr/local/bin/asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.beta.1 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

gem contents asciidoctor-pdf --show-install-dir
now results in:
/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1

cat /usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/themes/hit-theme.yml
extends: default
heading:
   font-color: #0066CC

ls -la  /usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/fonts

-rwxrwxrwx 1 root root     375 Jul 17 14:07 LICENSE-mplus-testflight-58*
-rwxrwxrwx 1 root root   11357 Jul 17 14:07 LICENSE-noto-2015-06-05*
-rwxrwxrwx 1 root root   15868 Jul 17 14:07 mplus1mn-bold-ascii.ttf*
-rwxrwxrwx 1 root root   15908 Jul 17 14:07 mplus1mn-bold_italic-ascii.ttf*
-rwxrwxrwx 1 root root   15928 Jul 17 14:07 mplus1mn-italic-ascii.ttf*
-rwxrwxrwx 1 root root   20024 Jul 17 14:07 mplus1mn-regular-ascii-conums.ttf*
-rwxrwxrwx 1 root root 1353324 Jul 17 14:07 mplus1p-regular-fallback.ttf*
-rwxrwxrwx 1 root root  234300 Jul 17 14:07 notoserif-bold_italic-subset.ttf*
-rwxrwxrwx 1 root root  221460 Jul 17 14:07 notoserif-bold-subset.ttf*
-rwxrwxrwx 1 root root  207852 Jul 17 14:07 notoserif-italic-subset.ttf*
-rwxrwxrwx 1 root root  220668 Jul 17 14:07 notoserif-regular-subset.ttf*

my commandline is:
/usr/local/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-fontsdir=/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/fonts -a pdf-style=/usr/local/lib64/ruby/gems/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.1/data/themes/hit-theme.yml  -o /u1/dcpa/etroot_entw/tmp/tmp.23867.pdf Noah.asc

with this commandline, no errors, but the theme hit-theme.yml is been ignored

I've tried also the commandline from the docs:
/usr/local/bin/asciidoctor-pdf -d book -b pdf  -a title -a pdf-themesdir=resources/themes -a pdf-fontsdir=resources/fonts -a pdf-theme=hit  -o /u1/dcpa/etroot_entw/tmp/tmp.25190.pdf Noah.asc

here also, no errors, but the theme hit is been ignored

for this, I've copied the fonts and the theme into the file-structure from the docs-example:

cd <sourcedir>
find ./resources
./resources
./resources/fonts
./resources/fonts/mplus1p-regular-fallback.ttf
./resources/fonts/notoserif-bold_italic-subset.ttf
./resources/fonts/mplus1mn-bold_italic-ascii.ttf
./resources/fonts/mplus1mn-italic-ascii.ttf
./resources/fonts/notoserif-italic-subset.ttf
./resources/fonts/LICENSE-mplus-testflight-58
./resources/fonts/notoserif-regular-subset.ttf
./resources/fonts/LICENSE-noto-2015-06-05
./resources/fonts/mplus1mn-bold-ascii.ttf
./resources/fonts/mplus1mn-regular-ascii-conums.ttf
./resources/fonts/notoserif-bold-subset.ttf
./resources/themes
./resources/themes/hit-theme.yml

cat resources/themes/hit-theme.yml
extends: default
heading:
   font-color: #0066CC


best regards from germany
Siegfried






If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-with-custom-style-problem-with-fonts-tp6992p6996.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

Siegfried Kurz
Hello Dan,
I was nearly giving up, then I found out:

This works:
cat resources/themes/hit_OK-theme.yml
extends: default
base:
    font-color: 00FFFF
heading:
    font-color: 0066CC

This does NOT work:
cat resources/themes/hit_ERROR-theme.yml
extends: default
base:
    font-color: #00FFFF
heading:
    font-color: #0066CC

When You look at my posts above, I've used the version with the leading #-chars.
According to the documention,  #0066CC should be equivalent to 0066CC

asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.beta.1 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

best regards from germany
Siegfried

Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf with custom style: problem with fonts

mojavelinux
Administrator
You are hitting a known bug in beta.1. The beta.2 release is due out in a few days. Until then, you have found the right workaround. Nice job.

Cheers,

-Dan

On Thu, Jul 18, 2019, 04:30 Siegfried Kurz [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello Dan,
I was nearly giving up, then I found out:

This works:
cat resources/themes/hit_OK-theme.yml
extends: default
base:
    font-color: 00FFFF
heading:
    font-color: 0066CC

This does NOT work:
cat resources/themes/hit_ERROR-theme.yml
extends: default
base:
    font-color: #00FFFF
heading:
    font-color: #0066CC

When You look at my posts above, I've used the version with the leading #-chars.
According to the documention,  #0066CC should be equivalent to 0066CC

asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.beta.1 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]) (lc:ISO-8859-15 fs:ISO-8859-15 in:ISO-8859-15 ex:ISO-8859-15)

best regards from germany
Siegfried




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-with-custom-style-problem-with-fonts-tp6992p7000.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML