Monospace text in

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

Monospace text in

geertpeeters


Hi,

I'm a bit stuck in generating monospace text as is typed in de adoc file, but with formatting of some parts (bold, color)

What I want to achieve is :
- Monospaced text
- Chord letters positioned on the right place above words
- Chords letters bold and colored in green
- Backing vocals in bold and colored in red

Blocks can render text as is, but can't seem to format parts of the text in bold or color at the same time.

*VERSE:*
....
*F*  G     Em7
Oh oh Alabama,
F         G              F         C
The devil fools with the best laid plans
F     G      Em7
Swing low Alabama.
F                          D
You got the spare change - you got to feel strange
E                  F           G
And now the moment is all that it meant.

Are there ways to achieve results as in above screenshot (from libre-office)
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

habamax
I think you can use verse block with redefined font in your theme file.
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

habamax
In reply to this post by geertpeeters


https://imgur.com/F8GgqPy

asciidoc excerpt
.VERSE
[verse]
______________________________________________________________________________

[chord]#F#  [chord]#G#     [chord]#Em7#
Oh oh Alabama,
[chord]#F#         [chord]#G#              [chord]#F#         [chord]#C#
The devil fools with the best laid plans
[chord]#F#     [chord]#G#      [chord]#Em7#
Swing low Alabama.
______________________________________________________________________________

.CHORUS
[verse]
______________________________________________________________________________
[chord]#F#                          [chord]#D#
[chorus]#You got the spare change - you got to feel strange#
[chord]#E#                  [chord]#F#           [chord]#G#
[chorus]#And now the moment is all that it meant.#
______________________________________________________________________________




theme example

extends: default

verse:
  font-family: M+ 1mn

role:
  chord:
    font_color: #00cc00
    font_style: bold
  chorus:
    font_color: #ff7070
    font_style: bold

Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

geertpeeters
Hi,

Thanks for the quick response. Actually I was building from an existing gradle project I used in a totally different context (user manual)
There I used an extended example from the internet.
I reduced now this YML to the attributes you proposed.

I pushed my project to https://github.com/geertpeeters/YellowMoonRising-Songbook

For one or another reason, the theme code is not picked up as my pdf output in test.pdf does not have colors nor Courier is used as font family

Am I missing something?

Thanks again
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

habamax
I know nothing about the pipeline you use... Just some questions:

1. Are you sure theme file is picked up? (did it work for you before  changes?)

2. Why are you using courier font? It is not one of built-in fonts and it is not provided anywhere in your project and is not specified in your theme as one of the fonts.  (see https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#custom-fonts)

3. Did you try the M+ 1mn font that I specified in my example? It is bundled with and used by asciidoctor-pdf and actually present in your repo.

4. Does it work for you with regular asciidoctor-pdf and built-in fonts?
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

geertpeeters
This post was updated on .
Hi Habamax,

Thanks for replying. I'm definitely not an expert in this thing

1. I used the gradle project before and used the same theme file with different content. So I'm pretty sure it was picked up before... Not sure why it is not picked up now
2. I though because it was monospace and better suited for aligning chord notations with lyrics. But no hard requirement. I can switch back to
3. I put back the font M+ 1mn
4. Not sure what you mean here. Can you share your tool chain and how a typical project structure can bring the result you showed? It's really cool knowing that it's possible...

EDIT : I threw the gradle project aside and used asciidoctor-pdf cli instead. Then is seems to work as you explained. Thank you for helping out.

Kind regards,

Geert
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

habamax
geertpeeters wrote
Thanks for replying. I'm definitely not an expert in this thing
I am not sure I am an expert :)

geertpeeters wrote
2. I though because it was monospace and better suited for aligning chord
notations with lyrics. But no hard requirement. I can switch back to
Usually it doesn't work this way. You can not set random font name to
asciidoctor elements in your theme file and expect it would be applied to a
document.

Theming (including how to use other fonts) is extensively described in a guide:
https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc

But basically you should either use already defined fonts with their font names (as M +1mn)
or define your own font names with real ttf files placed "next" to a theme file.

geertpeeters wrote
3. I put back the font M+ 1mn
And did it work for you?

geertpeeters wrote
4. Not sure what you mean here. Can you share your tool chain and how a
typical project structure can bring the result you showed? It's really cool
knowing that it's possible...
It is just a sudo gem install asciidoctor-pdf in linux environment or just a
gem install asciidoctor-pdf in Windows (with ruby installed beforehand).
Check https://github.com/asciidoctor/asciidoctor-pdf/#getting-started

To compile with default settings: asciidoctor-pdf filename.adoc

To add own theming consult asciidoctor-pdf parameters (you have to define path
to your theme, path to your fonts, extensions if you have any etc).

If you use vim then https://github.com/habamax/vim-asciidoctor might be handy.
Reply | Threaded
Open this post in threaded view
|

Re: Monospace text in

geertpeeters
I just installed asciidoctor and asciidoctor-pdf in Manjaro
I use Intellij as IDE

Just tried to set up a small project from scratch and included your theme snippet.
The thing is rendering just fine now.
Added some parts of my previous theme so I have headers and footers with page numbers.

I think I'm launched now and can progress experimenting further!

tnx a lot