Recent

Author Topic: [LazFreeType] Patches  (Read 58429 times)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: [LazFreeType] Patches
« Reply #15 on: April 09, 2012, 10:15:35 pm »
Which code ?

See in this file:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/customdrawn/customdrawnproc.pas?view=markup&root=lazarus

these routines:

procedure VerifyAndCleanUpFontDirectories(AFontDirectories: TStringList);
procedure FontsScanForTTF(APath: string; var AFontTable: THashedStringList);
procedure FontsScanDir(APath: string; var AFontPaths: TStringList; var AFontList: THashedStringList);

And then for each backend there are the routines:

procedure TCDWidgetSet.BackendListFontPaths(var AFontPaths: TStringList; var AFontList: THashedStringList);
function TCDWidgetSet.BackendGetFontPath(const LogFont: TLogFont; const LongFontName: string): string;

For example for Windows they are in this file:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/customdrawn/customdrawnwinapi_win.inc?view=markup&root=lazarus

And similar files exist for X11, Cocoa and Android.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #16 on: April 10, 2012, 01:06:17 pm »
I see. What I did is slightly different, but should be ok too.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #17 on: April 12, 2012, 04:17:29 pm »
Here is a patch that includes font collection, font style and family name.

How to use :
Code: [Select]
uses EasyLazFreeType, IntfGraphics, LazFreeTypeIntfDrawer, LazFreeTypeFontCollection;

var
  lazimg: TLazIntfImage;
  drawer: TIntfFreeTypeDrawer;   

begin
  FontCollection.AddFolder('c:\windows\fonts');  //for example

  lazimg := TLazIntfImage.Create(...);
  drawer := TIntfFreeTypeDrawer.Create(lazimg);     

  ft := TFreeTypeFont.Create;
  ft.Name := 'Arial';
  ft.Style := [ftsBold];     
  ft.LineFullHeight := 50; // height in pixels
  drawer.DrawText('The quick brown fox jumps over the lazy dog.',ft,0,0,colBlack,[ftaLeft,ftaTop]); 
  ft.Free;

  lazimg.free;
  drawer.free;
end;   
Conscience is the debugger of the mind

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: [LazFreeType] Patches
« Reply #18 on: April 13, 2012, 09:04:24 am »
Thanks, applied in rev 36741

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #19 on: April 14, 2012, 10:29:56 pm »
Now I can try to solve some bugs that are already reported.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #20 on: January 30, 2013, 10:00:25 pm »
Here is a new patch :
- extended characters handled correctly
- bug fix in case freetype font collection is freed before the drawer (added listeners when font collection item is destroyed)
- SetDefaultFreeTypeFontCollection in LazFreeTypeFontCollection unit, so it is not necessary to mention EasyLazFreeType in uses clause if font collection is used
- textrect and wordwrap for freetype
« Last Edit: January 31, 2013, 08:45:07 pm by circular »
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #21 on: January 31, 2013, 11:39:25 pm »
Applied in r40104.

However, since I am not the maintainer of LazFreeType,
I did not fully understand your code and only tested that it does not break existing example.

A few notes from quick browsing of the patch:
1) If I were LazFreeType maintainer, I would prefer a set of smaller patches, one for each logical change.
2) What does change to ttcmap do? It seems to me that you replaced code by equivalent one.
Or was it just refactoring?

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #22 on: February 01, 2013, 12:46:16 am »
Applied in r40104.

However, since I am not the maintainer of LazFreeType,
I did not fully understand your code and only tested that it does not break existing example.
Ok. New features will be used in next version of BGRABitmap, I already tested it on my computer.

EDIT : here is the link : http://www.lazarus.freepascal.org/index.php/topic,12390.msg112895.html#msg112895

Quote
A few notes from quick browsing of the patch:
1) If I were LazFreeType maintainer, I would prefer a set of smaller patches, one for each logical change.
I thought it was more convenient for update.

Quote
2) What does change to ttcmap do? It seems to me that you replaced code by equivalent one.
Or was it just refactoring?
There was a sign error, it's refactored too to make it more understandable.
« Last Edit: February 01, 2013, 01:38:33 am by circular »
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #23 on: February 01, 2013, 10:31:01 am »
Here is an updated test program for LazFreeTypeIntfDrawer (not using BGRABitmap), for examples/lazfreetype .
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #24 on: February 01, 2013, 10:55:49 am »
Thank you.

In the future, please update your checkout before changing files.
Your change reverted by last commit (r40103).

Also, it would be preferable to receive changes as patches as opposed to whole files.
Patches are easier to review before applying.

Merged and committed your changes in r40109.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #25 on: February 01, 2013, 11:29:43 am »
Thank you.

In the future, please update your checkout before changing files.
Your change reverted by last commit (r40103).
Sorry for that. It was the $R option, wasn't it?

Quote
Also, it would be preferable to receive changes as patches as opposed to whole files.
Patches are easier to review before applying.
Ok.

In fact I'm working with Lazarus 1.0 so it was not easy. I tried to switched to lastest subversion of Lazarus some time ago, but I was swamped in compilation issues.
« Last Edit: February 01, 2013, 11:33:35 am by circular »
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #26 on: February 01, 2013, 11:56:44 am »
Quote
It was the $R option, wasn't it?
No, it was small visual fix.

Quote
I tried to switched to lastest subversion of Lazarus some time ago, but I was swamped in compilation issues.
I use Lazarus trunk, and BGRABitmap works fine with it.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #27 on: February 01, 2013, 12:03:29 pm »
Quote
It was the $R option, wasn't it?
No, it was small visual fix.
Oh ok. It's a good idea to avoid flickering.

I thought you were talking about LazUtils units. There was a $R option in the beggining TTCMap unit, I don't know if it was removed by the patch.

Quote
Quote
I tried to switched to lastest subversion of Lazarus some time ago, but I was swamped in compilation issues.
I use Lazarus trunk, and BGRABitmap works fine with it.
Ok. I had no problem with compiling BGRABitmap itself, but with other things.

Another reason is that I wanted BGRABitmap to be compatible with Lazarus 1.0, so that people do not have to update with subversion. This principle is broken with the latest version of BGRABitmap 6.5, so I guess I can try to switch again to latest subversion of Lazarus.

This is more about TAChart : i've added one bug report, and i'm adding a second one.

EDIT: last version is 6.5
« Last Edit: February 01, 2013, 01:51:31 pm by circular »
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #28 on: February 01, 2013, 01:13:40 pm »
Quote
principle is broken with the latest version of BGRABitmap 6.4
I think it would be good to document Lazarus version requirements somewhere
in BGRABitmap documentation, stating that 6.3 is the last version compatible with 1.0, and you need 1.1 for later versions.

If you want, you can even branch "stable" BGRABitmap version, similar to Lazarus "fixes" branch.

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #29 on: February 01, 2013, 01:54:58 pm »
Ok. In fact, latest version is 6.5 and version 6.4 should still be compatible with Lazarus 1.0.

I've mentionned it on the wiki :
http://wiki.freepascal.org/BGRABitmap
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018