Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextOut: taCenter broken #80

Closed
circular17 opened this issue Nov 28, 2019 · 3 comments
Closed

TextOut: taCenter broken #80

circular17 opened this issue Nov 28, 2019 · 3 comments

Comments

@circular17
Copy link
Contributor

circular17 commented Nov 28, 2019

https://forum.lazarus.freepascal.org/index.php/topic,47527.0.html

I just updated BGRAbitmap from 9.9.3 --> 10060400

Suddenly a lot of text printed on BGRAbitmaps was gone.
As sometimes there were little lines at the right border I could find out that error quick:

taCenter as parameter for the TextOut is the reason.

The text is not printed in the center of the bitmap but starts at the right edge - sometimes leaving a little bit "dirt" at the border. The rest is writen into nowhere.

Just test:

    tmp: TBGRABitmap;
    tmp.TextOut(tmp.width div 2, y, MyText, color, taCenter);

You see that you see nothing....

Would be nice if you correct this!

Now I made some additional tests:

  • If I add a renderer and a shader to the BGRAbitmap then there is no problem with taCenter
  • With TextOutAngle there is no problem with taCenter

So it seems that only the plain textOut without renderer and without an angle has this problem.

Winni

@circular17
Copy link
Contributor Author

Hmm I just tested on Linux and see no problem.

Have you tried a clean build of BGRABitmap and your program?

@circular17
Copy link
Contributor Author

Hi circular!

Didn't get lost in the matrix jungle.

Now I give you two minus signs. As present.

Here is the "evil" one:

function TBGRACustomTypeWriter.GetTextMatrix(ATextUTF8: string; X, Y: Single;
        AAlign: TBGRATypeWriterAlignment): TAffineMatrix;

You forgot two minus signs. The code sgould be:

if AAlign in[twaTop,twaMiddle,twaBottom] then tGlyph.X := -size.x/2 else
    if AAlign in[twaTopRight, twaRight, twaBottomRight] then tGlyph.X := -size.x;

Since yesterday I know that textcolor inside pascal code in this editor together does not work so again her:

-size.x/2
and
-size.x

Now I need a beer.

Winni

@circular17
Copy link
Contributor Author

Thank you very much. I applied the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant