Re: Request for better script size and line height handling

On 11/10/2022 09:27, Lorenzo Bertini wrote:
> Il 11/10/22 08:51, Frédéric WANG ha scritto:
>> On 10/10/2022 23:30, Lorenzo Bertini wrote:
>>> Hello,
>>>
>>> please forgive me if this is the wrong place to ask.
>>>
>>> I've been authoring with MathML for a while, and one thing that 
>>> always bothered me is that <math> components break line height on 
>>> all my paragraphs that have them.
>>>
>>> For example, a symbol with many subscripts, as in
>>>
>>> <math>
>>> <mrow>
>>>  <msub>
>>>   <mi>ψ</mi>
>>>   <msub>
>>>    <mi>f</mi>
>>>    <mi>f</mi>
>>>   </msub>
>>>  </msub>
>>> </mrow>
>>> </math>
>>>
>>> will cause lines following the one containing it to be distanced in 
>>> the Firefox renderer.
>>>
>>> This happens all the time and makes the document look a bit rough 
>>> and unpolished. I would like it to mimic Latex's behavior, that is, 
>>> simply overflow in the next line. No way I tried (reducing 
>>> line-height, height, etc) has overcome this effect.
>>>
>>> Now, I don't know if this is MathML's or Firefox's fault, or if this 
>>> was intended all along; hence my worry for asking in the wrong 
>>> place. Let me know in case.
>>>
>>> A solution that works is to wrap the <math> element inside a <div> 
>>> element with for example "height: 1px" CSS property. Is there a way 
>>> this could be implemented "natively"?
>>>
>>> One a side note, why was "scriptminsize" deprecated? Is there a 
>>> substitute?
>>>
>>> Thank you lots for your time,
>>>
>>> Lorenzo
>>>
>>>
>> Hello,
>>
>> Is this a duplicate of 
>> https://bugzilla.mozilla.org/show_bug.cgi?id=947650 ?
>>
>> Have you followed instructions at 
>> https://developer.mozilla.org/en-US/docs/Web/MathML/Fonts ?
>>
>
> Yes, MathML fonts are all correctly installed and i can switch between 
> them; they all render as they should. They also all show this kind of 
> behavior though, so I don't think I have the same problem as that bug.
>
> My problem is that the engine calculates new line vertical position 
> based on the lowest element of the previous line: the infamous 
> \psi_{f_{f}} pushes that new line very far. I'll attach a picture 
> worth a thousand words.
>
> Is there a way to tell the renderer not to reserve space for <math> 
> elements? It will do it if I wrap <math> in a <div< and then ask for 
> that.
>
> Best regards

Thanks. I believe the MathML spec only defines what happens for the math 
formula and the box of the <math> would enclose the full content by 
default. So tweaking the CSS to force a different size seems the way to 
go. Otherwise using <mpadded> to reduce the height/depth might also work.

-- 
Frédéric Wang

Received on Tuesday, 11 October 2022 07:39:35 UTC