-
Notifications
You must be signed in to change notification settings - Fork 3k
Allow framed texts' frames to not demand width greater than (or equal to) height #28793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The vtests failures are happening due to this PR, but IMHO are harmless, it makes some frames around rehearsal marks a bit narrower, a very tiny bit for "A", a bit more for "C" |
|
Non-square rehearsal mark borders don't look great to me... @its-not-nice what do you think? |
|
Check how they look with multi-line text... |
|
Maybe an exception for (single letter) rehearsal marks? |
|
Or maybe separate rectangle and square options? |
|
To clarify: currently it is a rectangle, just with the restriction that it cannot be narrower than high, i.e. it can be wider than high. |
b3f0e7a to
e294ed8
Compare
|
Is this better? Only affects multi-line texts (with frames) now. Passes all vtests too... |
|
That might be a good compromise. However, let's wait for @its-not-nice's opinion. |
|
It is very unlikely for @its-not-nice to not have an opinion (on this) ;-) |
|
I assume the height (for a single line) is calculated from the font metrics (cap height or body height or whatever) plus the margin. So maybe all we need to do is enforce that same value as a minimum width, but otherwise to follow the actual width of the text when it goes beyond that. Maybe that's what the PR does already, I haven't tested it myself yet. There's also a relevant issue for this now! #30394 |
Minimum width of what? The frame goes around text, no text -> no frame. Same for height. If there is text (even if it is a space), its width (or height) is taken, plus the margins. rebased (and changed some new |
e294ed8 to
83859e0
Compare
|
Just came up on Discord: https://discord.com/channels/818804595450445834/818804809784229898/1428431078170820679 |
83859e0 to
ad974e4
Compare
|
Anything wrong with this approach? |
|
To me it should a rectangle that fits the text, no special minimum or maximum, except for single-character rehearsal marks, which should probably be square. On the other hand, I don't love the idea of literally special-casing single-character rehearsal marks. Correct me if I'm wrong, but I think @its-not-nice was suggesting using the line height of the font as the minimum height and width for the frame, but other than that letting the size be determined by the text. That works for me. It means "I" and "a" would get the same size square frame whether used as rehearsal marks or not, and that's fine by me. |
Yes, that was the idea. |
|
Isn't that what this PR is doing? |
|
The PR special cases the number of lines; that's not what I think we are agreeing on here. It also uses the calculated element height rather than the line height from the font metrics, which in theory might mean "a" and "A" could have different sizes. It should just use the font metric line height as the minimum for both the height and width. |
|
OK, how and where? |
|
Further up that method uses this for empty text: if (ldata->bbox().width() <= 1.0 || ldata->bbox().height() < 1.0) { // or bbox.width() <= 1.0
// this does not work for Harmony:
FontMetrics fm(font());
double ch = fm.ascent();
double cw = fm.width('n');
ldata->frame = RectF(0.0, -ch, cw, ch);
}So uses the Font's |
|
I would prefer to see no special casing based on number of lines at all. Just as simple as what was said above: take the line height of the font as the minimum for frame height and frame width, independently of the content of the element. So, calculation the height and width normally, then for both of those take a "max" of the calculated value and the line height of the font. This will allows "a" and "A" to have the same square box, and "I" the same width as "A", and normal text will just work regardless of number of lines. A vertical column of "I" characters should probably just as wide as a single "I", although I guess if someone had a real world use case in mind where it made sense to have a tighted width for the column, then it could make sense only apply that min for single-line texts. But right now that seems an unnecessary complication for no gain. As for how to get the font line height, I'm not versed enough in how things are done currently to say. That "fm.ascent" certainly seems promising, but I imagine there could be a complication if the text in question contains multiple fonts. But, whatever. we're just using this as a min value, if the text itself needs to be bigger, it will be. |
ad974e4 to
750840f
Compare
|
Split into 2 commits, one for the renaming of square to rectrangle and another for the (very simple) fix to allow for non-square frames for multi-line. Otherwise unchanged. It basically is a special case for having square frames on single letter framed texts, so especially for rehearsal marks. All other frames just follow their content, in width and height. |
|
Well, here's another attempt... (will merge the 2nd and 3rd commit if it passes muster) |
186021c to
4fe7d7b
Compare
|
When using |
as that is what it really is
as long as it is multi-line text
… font's height basically affects multi-line texts only
4fe7d7b to
a0daa5f
Compare







I don't see any special reason why a (rectangular) frame around text can't be higher than wide, esp. for multi-line texts.
It there is one, please enlighten me...
This PR also renames
FrameType::SQUAREtoFrameType::RECANTGLEandTextBase::square()toTextBase::rectangle(), because that's what these really are.Resolves: #30394