View Issue Details

IDProjectCategoryView StatusLast Update
0037012LazarusLazUtilspublic2020-05-08 11:00
Reportercircular Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.0.8 
Summary0037012: LazFreeType garbles some fonts
DescriptionSome fonts are not rendered correctly, in particular, there are vertical lines that appear.

It is due to a negative value used with SHR.
Steps To ReproduceRun the attached sample project.

See below how to fix.

Note: it may fix also issue 0021456.
https://bugs.freepascal.org/view.php?id=21456
Additional InformationTo fix, enforce c to be positive in MulDiv_Round function in TTCalc.Pas of LazUtils.

function MulDiv_Round( a, b, c : Int32 ) : Int32;
var
  temp: Int64;
begin
  temp := int64(a)*int64(b);
  if c < 0 then
  begin
    c := -c;
    temp := -temp;
  end;
  if temp >= 0 then temp += c shr 1
    else temp -= c shr 1;
  result := temp div c;
end;
TagsNo tags attached.
Fixed in Revisionr63125
LazTarget-
Widgetset
Attached Files

Relationships

related to 0021456 resolvedcircular [LazFreeType] Exception reading the font C:\Windows\Fonts\ahronbd.ttf 

Activities

circular

2020-05-03 18:30

developer  

testfreetype.zip (163,372 bytes)

Juha Manninen

2020-05-03 21:06

developer   ~0122618

@circular, you have a developer status here in bug tracker. The related issue is assigned to you.
Do you also have commit rights for the relevant directories?

circular

2020-05-03 22:18

developer   ~0122619

I don't recall having a commit access. I am not sure either what repository to use.

circular

2020-05-07 08:47

developer   ~0122652

For now, basically I have posted code on the bugtracker and it has been merged by reviewers.

Juha Manninen

2020-05-07 22:23

developer   ~0122662

I applied your change. Please provide a proper patch in the future.
Function MulDiv_Round is used in many places. I hope this does not break anything.
Please test.
Please test also the related issue.

circular

2020-05-07 22:46

developer   ~0122664

I have tested with various fonts, including arabic, devangari, bengali scripts.

Regarding the related issue, I tested it and works fine on Linux. However I am not sure it works on the considered platform.

Issue History

Date Modified Username Field Change
2020-05-03 18:30 circular New Issue
2020-05-03 18:30 circular File Added: testfreetype.zip
2020-05-03 20:59 Juha Manninen Relationship added related to 0021456
2020-05-03 21:06 Juha Manninen Note Added: 0122618
2020-05-03 22:18 circular Note Added: 0122619
2020-05-07 08:47 circular Note Added: 0122652
2020-05-07 22:00 Juha Manninen Assigned To => Juha Manninen
2020-05-07 22:00 Juha Manninen Status new => assigned
2020-05-07 22:23 Juha Manninen Status assigned => resolved
2020-05-07 22:23 Juha Manninen Resolution open => fixed
2020-05-07 22:23 Juha Manninen Fixed in Revision => r63125
2020-05-07 22:23 Juha Manninen LazTarget => -
2020-05-07 22:23 Juha Manninen Note Added: 0122662
2020-05-07 22:46 circular Note Added: 0122664