Recent

Author Topic: TextRect word wrapping  (Read 8037 times)

fenix

  • New Member
  • *
  • Posts: 10
TextRect word wrapping
« on: December 03, 2012, 07:13:31 am »
Hi,

Is it possible to disable word wrapping in TextRect procedure?

Thanks

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: TextRect word wrapping
« Reply #1 on: December 03, 2012, 10:43:14 am »
Yes, it is, using the longer version of TextRect method (with TextStyle parameter):
Code: [Select]
uses
  ..., Graphics;

var
  TextStyle: TTextStyle;
  R: TRect;
  Text: String;
...
  TextStyle := Canvas.TextStyle;
  TextStyle.Wordbreak := False;
  Canvas.TextRect(R, R.Left, R.Top, Text, TextStyle); //Of course, you should replace R and Text parameters with your values...
...
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

fenix

  • New Member
  • *
  • Posts: 10
Re: TextRect word wrapping
« Reply #2 on: December 03, 2012, 11:41:44 am »
Thank you, Zoran!

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: TextRect word wrapping
« Reply #3 on: December 03, 2012, 01:21:12 pm »
You are welcome, but only now I noticed that this topic is under BGRA subforum. :-[
My answer was about TCanvas.TextRect, but perhaps (hopefully) you can use the similar solution with BGRA library.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

circular

  • Hero Member
  • *****
  • Posts: 4471
    • Personal webpage
Re: TextRect word wrapping
« Reply #4 on: December 05, 2012, 10:14:44 am »
Yep, there is :
Code: [Select]
procedure TBGRABitmap.TextRect(ARect: TRect; x, y: integer; s: string; style: TTextStyle; c: TBGRAPixel);
procedure TBGRABitmap.TextRect(ARect: TRect; x, y: integer; s: string; style: TTextStyle; texture: IBGRAScanner);
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018