• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fonts + Fontsize for ABC - workaround
#1
Hurray! With 3.9.17 I found a pragmatic workaround for working with fonts and font sizes.

What I need:
- combine ABC, chord grids and lyrics+chords in ChordPro files
- the same font for lyrics+chords, chord grid & ABC sections
- big chords with good readability
- 'real' sharps & flats
- the ability to use the same ChordPro source files that I use in MobileSheets to produce PDFs with the ChordPro Reference Implementation

What I do:
- I use a set of ChordPro config files that specify MuseJazzText as chord font and specify fonts and font sizes for lyrics+chords and chord grids
- I add %%xxxfont * <size> or %%xxxfont * bold <size> ( %%gchordfont, %%vocalfont, %%titlefont) to every ABC section in my ChordPro source files
 
What I get:
- the * in %%xxxfont * means "keep the font unchanged that is specified somewhere else" so
-- MobileSheets uses its default fonts specified by Mike depending on the OS that is used
-- the ChordPro Reference Implementation uses the fonts specified in its config files e.g. MuseJazzText for chords
- the <size> in the %%xxxfont directives overwrites the font sizes and weight (bold or not) for the ABC sections
- the font sizes for title, subtitle, lyrics ... are specified
-- for MobileSheets in 'Text Display Settings' and stored in the database
-- for the ChordPro Reference Implementation in the ChordPro config files

And here are some sample results, from MobileSheets 3.9.17 and from ChordPro using a size=12 and a size=20 config file:
           

Open points:
- the ChordPro Reference Implementation seems to ignore "bold".
- MobileSheets does not yet convert b and # in chords to 'real' sharps and flats
- I probably won't get MuseJazzText in ChordPro in the near future.


Attached Files
.pro   AfterYouveGone-FontSize_ABC.pro (Size: 1.08 KB / Downloads: 6)
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#2
Your Em at the bottom should be an Eb. ;-)

But otherwise I appreciate you checking out all the chordpro and ABC things. I don't get to that as much as I'd like.
Reply
#3
The Em is just a typo. In fact I noticed it when I had almost finished my post and decided to leave it as is, so that the ChordPro source keeps matching the screenshot.
And yes, I invest a lot of time in investigating technical details of ABC, ChordPro, MobileSheets and the like. Sometimes I think I should better take my instrument and practice...
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#4
Here's an example from the real life that already looks pretty good
   
BUT in certain constellations (in this case I inserted an additional lyrics line) the ABC section at the end of the song disappears completely instead of being moved to the next page
   


Attached Files
.pro   ThoseWereTheDays_SHe_ABC.pro (Size: 1.45 KB / Downloads: 2)
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#5

.pro   ThoseWereTheDays_SHe_gchordfont_bold_ABC.pro (Size: 1.45 KB / Downloads: 4)
The same ChordPro on my laptop's landscape display
   
This screenshot was taken directly after importing the file, no font sizes changed manually so far. I wonder why the width of lyrics and ABC are rendered as if the display was in portrait format wheras grids take the full landscape width.

It would look even better if I could change the chord font of the ABC section to bold. So I change the font setting to
%%gchordfont * 24 bold
and to my surprise the chords are bold, but the size value is ignored
   
when I transpose to Gm the flat symbols get lost
   
After clicking "Auto-size font" the fonts for lyrics and grids are much bigger, the ABC section stays unchanged
   
It seems that Auto-Size is applied differently during import
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#6
(04-06-2025, 05:34 PM)itsme Wrote: ... %%gchordfont * 24 bold
and to my surprise the chords are bold, but the size value is ignored ...

This is probably due to the font used.
I use the MuseJazzText font and can change the chord size.

(04-06-2025, 05:34 PM)itsme Wrote: ... when I transpose to Gm the flat symbols get lost ...
The “b” also works with the MuseJazzText font.
   

I have extended your song with my ABC block.


Attached Files
.txt   Those_Were_The_Days_MuseJazzText.txt (Size: 2.12 KB / Downloads: 6)
---------------------------------------------------------
13" - Point of View POV_TAB-P1325, Android 4.1.1
13" - Point of View POV_TAB-I1345, Android 5.1.1
Microsoft Surface Pro 4; Windows 10
Phone: Motorola Moto G3, Android 6.0
Reply
#7
@Vibraphon: Thank you for your fast reply and your interesting ABC block. I really love MuseScoreText and use it regularly in MuseScore and the ChordPro reference implementation. Alas it doesn't work in MobileSheets on Windows, see screenshot (showing the modified ChordPro file with your ABC block and a text file that demonstrates that MuseScoreText is available and usable on that device). That's why I came up with this workaround. On what OS can you use MuseScoreText with your ABC block and what was necessary to make it work?
   
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#8
@itsme: Fortunately, I was able to solve the problem because I had previously tried to create my own font. I had downloaded the FontLab software for this purpose. You can use it legally for 10 days as a trial.

Because MuseJazzText wouldn't work for me either, but my self-made (but worse) font would, I had a look at the MuseJazzText font in FontLab.

I noticed that the full name of the MuseJazzText font contains a space: “MuseJazz Text”. However, abc cannot handle this space, as it then expects other information, such as sizes or box.
   
I then simply saved the font as a copy in FontLab, but now without the space at Full name and Family name.
   
I don't dare to post the modified font here because I'm not familiar with copyright regulations.

HTH
---------------------------------------------------------
13" - Point of View POV_TAB-P1325, Android 4.1.1
13" - Point of View POV_TAB-I1345, Android 5.1.1
Microsoft Surface Pro 4; Windows 10
Phone: Motorola Moto G3, Android 6.0
Reply
#9
If you want the ABC section to take up the entire width of the page, add %%stretchlast to the abc block. Then abc2svg will expand it to take up the entire width.

As far as the second problem, that's something I actually already fixed last week. So the fix will be included with the next update. The issue occurs when a page wrap occurs but the only thing on the next page is an ABC section. The code was not accounting for that and did not process the next page unless there were lyrics/chords/etc that needed to be processed. So if you put something after the abc section (even a single character), that would function as a workaround.

Mike
Reply
#10
%%stretchlast 
Inserting %%stretchlast fixed the issue that the ABC line did not take the whole page width. I know about %%stretchlast and use it all the time for ABC sections that have more than one line. It just did not come into my mind as on my HP Detachable with the display in portrait orientation that issue was not there, no difference if %%stretchlast is included or not.

missing ABC line
Great that the issue with the disappearing ABC line is fixed.

MuseJazzText
I'm surprised that this happens as both LibreOfffice Writer and the ChordPro reference implementation can use MuseJazzText without issues. I admit it took several iterations until it worked properly in the ChordPro reference implementation. I ended with using the filename instead of the font name in ChordPro's config files:
Code:
"fonts" : {
// "name" is for built-in chords only. See https://chordpro.org/chordpro/chordpro-fonts/
//            "name" : "Times-Bold",
//            "file" : "MuseJazzText.otf",
//            "file" : "C:\\Windows\\fonts\\MuseJazzText.otf",
...
        "chord" : {
        "file" : "MuseJazzText.otf",
        "size": 13
        },
...

For MobileSheets:
I tried using the filename also in MobileSheets, without success:
%%gchordfont MuseJazzText.otf 30
%%gchordfont MuseJazzText.ttf 30

and I tried enclosing the font name in quotes, without success:
%%gchordfont "MuseJazz Text" 30

And I was able ro remove the blanks from the font names, as proposed by Vibraphon. I used FontForge (which is open source)
https://fontforge.org/en-US/   -   https://portableapps.com/apps/utilities/...e-portable
But I was not able to install that modified font version, Win 11 did not allow me to replace
c:\Program Files\WindowsApps\41730Zubersoft.MobileSheets_3.9.17.0_x64__ys1c8ct2g6ypr\Assets\Fonts\MuseJazzText.ttf
@Mike: 
any hint what I need to do to test my modified font? 
or shall I send you the modified font by e-mail?
I assume the fonts in the mentioned folder are installed by MobileSheets. Are they also available on other OSs?
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#11
MobileSheets will have abc2svg generate the .svg file to render under C:\Users\<your username>\AppData\Local\Packages\41730Zubersoft.MobileSheets_ys1c8ct2g6ypr\TempState. It may be in a folder containing a UUID to prevent file conflicts. If you can open up the .svg, it would help to know what font is listed in there for the chords (you can send me the file if it's confusing to look at). When MobileSheets opens the .svg file, the SVG framework on Windows (Svg.Skia) will ask for a font with the name listed in the svg file. MobileSheets will call into Skia to load a font with the given name. The Skia framework should look at all of the fonts installed in the operating system and return the font if a match is found. If no match is found, MobileSheets will fall back to using the default font for the OS.

So the only thing you should need to do is install the Font in the OS, then verify that the name you are passing matches the name for that font in the OS. You can do this by searching for "Fonts" using the Windows taskbar, then click on the MuseJazzText font and see what Full name is listed. For MuseJazzText, I see it listed as "MuseJazz Text", so that would be the name that should be used. The real question here is, what is abc2svg writing into the svg file for the font family name? That may help us understand what is happening.

As far as installing the modified font, please first go to the "Fonts" folder I mentioned, then uninstall MuseJazz Text, and then install your modified font. Hopefully that will work.

As far as the Fonts folder, that location is normally inaccessible, but those are all the font files I package with MobileSheets. The code has to be modified to look up any fonts in that folder - you can't just insert fonts in there and MobileSheets will know how to use them. I have to add code to also map font names in svg files to fonts that are part of the assets, so if I want to add support for more fonts (which is certainly planned), there has to be code to make that happen - it can't really be dynamic in nature. I will add MuseJazzText support for the next update though so that it can be used without the font being installed in the OS.

Mike
Reply
#12
Quote:I will add MuseJazzText support for the next update though so that it can be used without the font being installed in the OS.

That's great. I'm looking forward to that. Will that work on all OS? iOS too?
Reply
#13
Yes it will work on all operating systems. 

Mike
Reply
#14
(04-09-2025, 04:46 AM)BRX Wrote:
Quote:I will add MuseJazzText support for the next update though so that it can be used without the font being installed in the OS.

That's great. I'm looking forward to that. Will that work on all OS? iOS too?

Fantastic. No more need to experiment with workarounds and tweaking the MuseJazzText font. I'll wait for the next update and test it thoroughly.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 22H2 - Huawei Media Pad T5, Android 8.0 - Boox Tab Ultra C, Android 11
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#15
itsme - There's one thing I wanted to mention. The gchordfont documentation states this:

xxxfont font_name [style/weight] [encoding] [size] [arguments]

So you'd want %%gchordfont "MuseJazz Text" bold 24

I just wanted to mention this as your file had it in the wrong order (i.e. 24 bold).

I tested this file on all three platforms after my changes and MuseJazzText font is correctly used now.

Mike
Reply




Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2025 MyBB Group.