Posts: 7
Threads: 3
Joined: Nov 2021
Reputation:
0
06-25-2024, 08:53 AM
(This post was last modified: 06-25-2024, 08:53 AM by DavidBoothe.)
When using the text tool, with text size set to 12, the entire text block shifts position when exiting the text box - to create another box, save the annotation, etc.
With serif font, the block shifts 3 pixels down and 1 pixel to the right. With sans serif, there is no vertical shift, but it does shift 1 pixel to the right.
This is a problem when marking fingerings into a dense piano score, especially with the serif font. Serif is prefereable for easy readability.
Any help appreciated.
Thank you.
dB
-----------
Samsung Galaxy Tab S7 FE
Android 14
MobileSheets Pro 3.8
Posts: 13,284
Threads: 301
Joined: Apr 2012
Reputation:
234
06-25-2024, 10:41 AM
(This post was last modified: 06-25-2024, 10:41 AM by Zubersoft.)
This is an incredibly complex problem, even though it may seem simple on the surface. In order to make it appear like you are entering text directly on the page, I am dynamically inserting a text edit control on the page, but I make it's background transparent and I try to position it exactly where it should be to enter text based on the insertion point. However, the text component behavior is not something I have complete control over, and there are considerations with the font metrics, line spacing, typeface, etc when trying to figure out the exact position to place it. When the finger is lifted, I hide the text edit control and revert back to just rendering the text on the page using the skia graphics library on Android. However, there is scaling that has to happen - the annotation is stored relative to the raw PDF page size, not the scaled size, in order to ensure it scales properly across different devices, orientations, scale settings, etc. So while the text font size was just set to "12" while you were entering the text with the edit control, for example, it might be saved as 3.49 relative to the PDF page, but then it's scaled up by the page scaling factor, and it might be something close to 12 but not exactly (the scaling also occurs with the coordinates of the text). So it's hard to know if the offset position is due to something happening internally in the edit control where it's padding the insertion point or doing some other processing that places it offset from the insertion point, or if it's due to the scaling causing it to be offset a little bit. It could also be caused by the way Android handles text measurements with different fonts, causing some small discrepancies there.
I'll have to revisit this to see if I can improve it at all, but in order to get things working fairly well with the default font (sans serif), I had to add some small offsets at different font sizes to get it to all line up properly when going between editing a text annotation and displaying it normally. This is obviously not working as well with serif for some reason. This capability has been a real pain to deal with.
Mike
Posts: 7
Threads: 3
Joined: Nov 2021
Reputation:
0
Thanks for the detailed information, Mike. I suspected it might have something to do with font metrics, but, of course, had no idea of the problem's complexity. I could not find that anyone else had mentioned this problem, so maybe it's only an issue for me, in which case, it would not seem to be a priority.
I originally was using the default (sans) font and had gotten pretty good at estimating where to put the text box to account for the horizontal shift. I recently switched to serif for quick readability. So, with pracfice, I can probably get better at accounting for the vertical shift, as well.
Thanks again for your help.
dB
-----------
Samsung Galaxy Tab S7 FE
Android 14
MobileSheets Pro 3.8