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;
|
||||
|
||||
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);
|
||||
ReadNSFontParams(dict, prm);
|
||||
if Assigned(prm.font) then begin
|
||||
@ -335,6 +345,7 @@ begin
|
||||
trt:=trt and (not fallback[i]);
|
||||
fd:=fd.fontDescriptorWithSymbolicTraits(trt);
|
||||
fdd:=fd.matchingFontDescriptorWithMandatoryKeys(nil);
|
||||
inc(i);
|
||||
end;
|
||||
Result:=fdd;
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user