richmemo: fix font matching logic, preventing infinite loop. updating GetTextAttribute policy for cases when there's no text
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7570 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
8f9163c3b8
commit
d8ab6b738e
@ -247,6 +247,16 @@ begin
|
|||||||
if not Assigned(view) then Exit;
|
if not Assigned(view) then Exit;
|
||||||
|
|
||||||
txt:=view.textStorage;
|
txt:=view.textStorage;
|
||||||
|
if (txt.length = 0) then begin
|
||||||
|
// there's no text! using the control information
|
||||||
|
Params.Name := txt.font.displayName.UTF8String;
|
||||||
|
Params.Size := Round(txt.font.pointSize);
|
||||||
|
Params.HasBkClr := false;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (TextStart >= txt.length) then
|
||||||
|
TextStart := txt.length;
|
||||||
dict:=GetDict(txt, textStart);
|
dict:=GetDict(txt, textStart);
|
||||||
ReadNSFontParams(dict, prm);
|
ReadNSFontParams(dict, prm);
|
||||||
if Assigned(prm.font) then begin
|
if Assigned(prm.font) then begin
|
||||||
@ -335,6 +345,7 @@ begin
|
|||||||
trt:=trt and (not fallback[i]);
|
trt:=trt and (not fallback[i]);
|
||||||
fd:=fd.fontDescriptorWithSymbolicTraits(trt);
|
fd:=fd.fontDescriptorWithSymbolicTraits(trt);
|
||||||
fdd:=fd.matchingFontDescriptorWithMandatoryKeys(nil);
|
fdd:=fd.matchingFontDescriptorWithMandatoryKeys(nil);
|
||||||
|
inc(i);
|
||||||
end;
|
end;
|
||||||
Result:=fdd;
|
Result:=fdd;
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user