• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text file Spacing
#1
Thanks for adding the code to the rendering of text based song sheets to allow for the "|" character in a chord line but I noticed that there is an issue with the leading spaces in a line.  It seems like the leading spaces in the line is being ignored during the rendering process.  This is causing an alignment issue with the chord line and the lyrics line.

Example:
            | C           | Am                 | Dm 
Verse 1:  This is the beginning of the song lyrics
        
will end up looking like the following when the sheet is displayed even if it looks correct in the Edit screen of the song sheet
| C           | Am                 | Dm 
Verse 1:  This is the beginning of the song lyrics

Can this be corrected.   Also, is the tab character recognized in a text based song sheet and if so how does the rendering process determine the number of spaces the tab character will translate to and show the correct spacing when the song sheet is displayed.
Reply
#2
As long as you put a space between the | character and the chord, everything should be fine. I just tested this to be sure, and it worked as I would expected. If I put the | next to the chord, i.e. |C, then I ran into some issues as it's no longer recognized as a valid chord. The only change I made was to ignore standalone | characters when determining if something is a chord line - I did not change how the chords in that line are processed and |C will not be ignored - it will be considered a non-valid chord when determining if it's a chord line. If you can send me the file you are using, I'll take a look, but with my tests so far, everything is fine even when I enter exactly what you wrote above.

As a side note, make sure when editing your files that you use an editor with a fixed width font. Each space should be the same width as a single letter. Also, if you changed the font you are using for your text files, or any other relevant text settings, let me know.

Mike
Reply
#3
Thanks Mike.  Will do more testing and update you on what I can determine.
Reply
#4
I have done more testing and have the following questions:

1. Does the font you select in the Text File Settings have any impact on the Import process ie. does the processing of the text file during the import process use the font selected in the Default Display Settings. My thought is the font selected does not have anything to do with the Importing process and is only used to determine how to render and display the text file.


2. I have be trying various fonts to create the text file and once the file is imported into Mobile Sheets, the characters displayed position in the sheet does not match the text file shown in Windows Notepad, below is just one example:
                      | F  | A          | Dm  | D          | Gm
12345678901234567890123456789012345678901234      

will show up as

                                        | F       | A                   | Dm  | D         | Gm
12345678901234567890123456789012345678901234

Can this be related to the font used to create the file and the font selected in the Text File Settings not matching exactly.

3. The Font available in the Default Display Settings under Text File Settings have a limited number of fonts listed.  Can the font Microsoft YaHei be added to the list as I need to use that font to create some of the song sheets containing some non-English characters.
Reply
#5
Yes, if you change the font in the default text display settings, that font is used during import to figure out the number of pages (which also validates that the file can be loaded).

Most fonts are variable-width fonts. That means different characters take up different amounts of space. If you use Windows notepad, that is using a fixed-width font (also known as monospace). If you select the monospace font in MobileSheets, it will match what you are seeing in notepad (it isn't the most visually pleasing font though).

As far as your last question, I don't currently support importing fonts. That's something I may consider supporting in the future.

Mike
Reply
#6
I recoommend using ChordPro instead of .txt
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
#7
(03-18-2024, 03:59 PM)Zubersoft Wrote: Yes, if you change the font in the default text display settings, that font is used during import to figure out the number of pages (which also validates that the file can be loaded).

Most fonts are variable-width fonts. That means different characters take up different amounts of space. If you use Windows notepad, that is using a fixed-width font (also known as monospace). If you select the monospace font in MobileSheets, it will match what you are seeing in notepad (it isn't the most visually pleasing font though).

As far as your last question, I don't currently support importing fonts. That's something I may consider supporting in the future.

Mike

I suspect what may be causing the alignment problem is the leading spaces in a line is not monospaced even though the font chosen is Monospace or the space character does not follow the Monospace width.  What I did is just create a simple text file using Windows Notepad with the Font Consolas which is a monospaced font.  The file is like the following:
(14 spaces)        |F        |C      
123456789012345678901
In Notepad, the "|" bar line is right on position 15 and the second "|" bar line is at position 21.
Then I set the Text File Setting FONT in Mobile Sheet to Monospace and then Import the text file I created.  When the file is displayed, the first "|" bar line is now showing up in position 7 instead of 15 and the second "|" bar line is now in position 10 instead of 21.
Reply
#8
Alright, I'll have to look into this to see if I can easily reproduce it.

Mike
Reply
#9
I can't reproduce this issue with 3.8.38, however it's critical that you place a space between your | characters and the chord, otherwise the chord will be detected as invalid. I set up a file like you described, but with a space after the | characters:

Code:
              | F   | C     
123456789012345678901


When I loaded the file in MobileSheets, the chords are displayed over the same characters as they are in the editor, which uses a monospace font. If I change the font in MobileSheets to Monospace, this doesn't change anything, as the positioning is still correct. However, if I don't have the space (i.e. |F and |C), then the file is displayed in a different fashion with the default font, because those aren't treated as valid chords, so they aren't lined up with the lyrics beneath them.

If you don't like that, you should switch to chord pro, as it is more explicit about chord declarations.

Mike
Reply




Users browsing this thread:
1 Guest(s)


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