[fpc-devel] Possible bugs in TFreeTypeFont

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Thu Jan 6 19:53:08 CET 2011


Should I create a bug report for this?

Regards, Darius


On Dec 16, 2010, at 1:26 AM, Darius Blaszyk wrote:

> IMHO there is a bug in TFreeTypeFont.SetFlags. The check that determines
> if the inherited method should be called seems to be wrong. Can someone
> confirm? Please consider the following patch:
> 
> @@ -183,7 +183,7 @@
> 
> procedure TFreeTypeFont.SetFlags (index:integer; AValue:boolean);
> begin
> -  if not (index in [5,6]) then   // bold,italic
> +  if (index in [5,6]) then   // bold,italic
>     inherited SetFlags (index, AValue);
> end;
> 
> Secondly TFreeTypeFont.GetFlags seems to have a bug in as well. My class
> that descends from TFreeTypeFont calls the Bold and Italic methods, but
> never the correct setting is returned. Because the SetXXX method stores
> the settings in FFlags, I would expect FFlags to be used to restore the
> settings and not some value of FFace. I have modified the code (as seen
> below), but I guess someone should reconsider this and determine if I am
> right at this, or some other evaluation algorithm should be implemented
> instead.
> 
> @@ -198,14 +198,14 @@
>   if index = 5 then        //bold
>     begin
>     GetFace;
> -    result := (FFace^.style_flags and FT_STYLE_FLAG_BOLD) <> 0;
> +    //result := (FFace^.style_flags and FT_STYLE_FLAG_BOLD) <> 0;
>     end
>   else if index = 6 then    //italic
>     begin
>     GetFace;
> -    result := (FFace^.style_flags and FT_STYLE_FLAG_ITALIC) <> 0;
> -    end
> -  else
> +    //result := (FFace^.style_flags and FT_STYLE_FLAG_ITALIC) <> 0;
> +    end;
> +  //else
>     result := inherited GetFlags (index);
> end;
> 
> Regards, Darius
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list