[metapost] bug in the label bbox
luigi scarso
luigi.scarso at gmail.com
Thu Aug 20 10:20:48 CEST 2020
On Mon, Aug 17, 2020 at 4:09 PM luigi scarso <luigi.scarso at gmail.com> wrote:
>
>
> On Thu, Aug 6, 2020 at 8:28 PM Martin Budaj <m.budaj at gmail.com> wrote:
>
>> Hi,
>>
>> when using numbersystems other than scaled, the following example
>> fails to calculate the bounding box of an empty label (MetaPost
>> version 2.00):
>>
>> beginfig(1);
>> path q;
>> q:=bbox thelabel("",(0,0));
>> message "BBOX: " & decimal xpart llcorner q & " " &
>> decimal ypart llcorner q & " " &
>> decimal xpart urcorner q & " " &
>> decimal ypart urcorner q;
>> endfig;
>> end
>>
>> The results are:
>>
>> scaled (OK, as bboxmargin is 2bp):
>> BBOX: -2 -2 2 2
>> decimal:
>> BBOX: -2 -1E+1000000 2 1E+1000000
>> binary:
>> BBOX: -2 -9.999999999999999999999999999999999E+999999 2
>> 9.999999999999999999999
>> 999999999999E+999999
>> double:
>> ! Arithmetic overflow.
>>
>> Best regards
>> Martin
>> --
>> http://tug.org/metapost/
>>
>
> hm, in mp_set_text_box
>
> @<Set the height and depth to zero if the bounding box is empty@>=
> if (number_to_scaled(p->height) < -number_to_scaled(p->depth)) {
> set_number_to_zero(p->height);
> set_number_to_zero(p->depth);
> }
>
> works only for scaled mode, the others skip the test because
> number_to_scaled doesn't work if the value is neg_inf.
> I am doing some tests.
>
>
ok, fixed. I will commit this weekend.
--
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20200820/ac6fc69b/attachment.html>
More information about the metapost
mailing list.