SetIdenticalFontSources design error

Post your requests and ideas on the future development of Visual TFT Software.
Post Reply
Author
Message
Findus
Posts: 87
Joined: 05 Oct 2012 15:28

SetIdenticalFontSources design error

#1 Post by Findus » 29 Aug 2016 09:37

Hello,

I think the function SetIdenticalFontSources is a big design error.

these code lines are called for RadioButton, EveToggle, EveButton, EveText

Code: Select all

    while (i) do
    begin
      pRadioButton := TRadioButtonPtr(ptrO^);
      if (pRadioButton^.FontHandle < 16) then
      begin
        if (pRadioButton^.Source = -1) then
        begin
          currSource := FT800_Res_LoadFont(pRadioButton^.FontName);
          pRadioButton^.Source := currSource;
          SetIdenticalFontSources(pRadioButton^.FontName, currSource);
        end;
      end;
      Inc(ptrO);
      Dec(i);
    end;
And SetIdenticalFontSources set for all RadioButton, EveToggle, EveButton, EveText the Source if the Fontname match.

These routine is always called in LoadCurrentScreenResToGRAM and does nothing after the first FT800_Res_LoadFont. The font is still there.

if there is a table of FontHandle to Source like

Code: Select all

var
   FontTable: array[0..15] of record 
     FontName: ^char
     FontSource: longint;
   end;
then you can use this function:

Code: Select all

procedure LoadFont(FontHandle: longint);
begin
    if (Fonthandle<16) and (FontTable[FontHandle].FontSource=-1) then begin
       FontTable[FontHandle].FontSource := FT800_Res_LoadFont(FontTable[FontHandle].FontName);
    end;
end;
The FontTable can directly created by VTFT and the LoadFont can call in the main installation of the FT800 for all used font. And you never ever have to call SetIdenticalFontSources or check whether the font is loaded..

best regards
Thomas

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: SetIdenticalFontSources design error

#2 Post by biljana.nedeljkovic » 31 Aug 2016 16:23

Hello,

Your idea is good in terms of your own application.
With our approach, we were trying to get bigger perspective to more cases that can happen.

It might seems like there is an unnecessary loop there, we have reviewed the code and determined it is, for now, the good approach for this matter.

Thank you for your feedback nonetheless.

Best regards,
Biljana

Post Reply

Return to “Visual TFT Wish List”