Recent

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

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #30 on: February 02, 2013, 12:50:00 am »
Here is a new patch :
- external access about hinted option
- font hinting when text center
- OnRenderText event added
- line ending when splitting
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #31 on: February 02, 2013, 01:52:26 pm »
I have applied first part of the patch in r40120.

I have few questions about other parts:

>external access about hinted option
Are there other descendants of TFreeTypeRenderableFont?
If so, they should be updated to be compilable after this change.

>line ending when splitting
I can not understand what this change is supposed to do.
Can you write a commit message for it?

Also, code of RemoveLineEnding function seems too complicated.
Is not it equivalent to the following?
Code: [Select]
Result := (index <= Length(s)) and (s[index] in [#13, #10]);
if Result then
  if (index + 1 <= Length(s))  and ([s[index + 1], s[index]] = [#13, #10]) then
    Delete(s, index, 2)
  else
    Delete(s, index, 1);

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #32 on: February 02, 2013, 06:30:32 pm »
>external access about hinted option
Are there other descendants of TFreeTypeRenderableFont?
If so, they should be updated to be compilable after this change.
No.

Quote
>line ending when splitting
I can not understand what this change is supposed to do.
Can you write a commit message for it?
When there are #13#10 chars in a string, they are taking into account when splitting the text, i.e. text goes to a new line before reaching the maximum width.

Quote
Also, code of RemoveLineEnding function seems too complicated.
Is not it equivalent to the following?
Code: [Select]
Result := (index <= Length(s)) and (s[index] in [#13, #10]);
if Result then
  if (index + 1 <= Length(s))  and ([s[index + 1], s[index]] = [#13, #10]) then
    Delete(s, index, 2)
  else
    Delete(s, index, 1);
I would say so, but this part seems slower (more complicated for the compiler) :
Code: [Select]
[s[index + 1], s[index]] = [#13, #10]
« Last Edit: February 02, 2013, 06:32:06 pm by circular »
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #33 on: February 02, 2013, 06:40:44 pm »
Here is another patch to apply to easylazfreetype.pas :
- OnRenderText event moved upwards to be accessible from TFreeTypeRenderableFont
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #34 on: February 02, 2013, 06:44:23 pm »
And another to add text decoration (underline and strikout) in TIntfFreeTypeDrawer :
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #35 on: February 03, 2013, 01:06:39 am »
Quote
Quote
Are there other descendants of TFreeTypeRenderableFont?
No.
Ok, committed in r40130

Quote
text goes to a new line before reaching the maximum width.
Quote
... but this part seems slower (more complicated for the compiler)
Ok, I have taken a look from the optimization point of view.
Committed modified version of this change in r40131-40133. Main differences are:
1) No extra calls to "Delete" (note that "Delete" contains a loop)
2) No extra loop variable (in you version, "p" did the same as "left")

Quote
OnRenderText event moved upwards to be accessible from TFreeTypeRenderableFont

Committed in r40134. Please create patches from "lazarus" or "lazutils" directory, not from the disk root. Otherwise, patches include absolute paths which I have to edit manually before applying.

Quote
add text decoration (underline and strikout)
Committed with minor modification in r40135.
However, I have doubts about design -- should not underline/strike-out be a property of a font?
« Last Edit: February 03, 2013, 01:39:17 am by Ask »

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #36 on: February 03, 2013, 10:53:54 am »
Thanks.

Quote
Quote
add text decoration (underline and strikout)
Committed with minor modification in r40135.
However, I have doubts about design -- should not underline/strike-out be a property of a font?
Oh you're right. I'll try to move it there.
« Last Edit: February 03, 2013, 11:23:30 am by circular »
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #37 on: February 03, 2013, 11:24:05 am »
Here is the patch to move text decoration into font :
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #38 on: February 03, 2013, 11:48:29 am »
Applied in r40147.
In the future, please update your working copy before creating a patch --
the one you sent reverted changes I made in r40131.

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #39 on: February 03, 2013, 01:54:59 pm »
Alright.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #40 on: February 03, 2013, 04:12:05 pm »
This is not exactly about FreeType, but there are drawing routines in the drawer that could be moved to FPCanvas.
Conscience is the debugger of the mind

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: [LazFreeType] Patches
« Reply #41 on: February 04, 2013, 03:25:41 am »
I have no commit access to the FPCanvas. You can create a feature request on the bug tracker.

Note, however, that FPC releases are very rare, and Lazarus traditionally allows some lag in FPC version, so even if those routines are copied to FPCanvas, they must remain in LazFreeType until FPC 2.8 comes out *and* becomes a minimum required version for Lazarus.

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #42 on: February 04, 2013, 11:41:00 am »
I understand.

Just in case, to whom could I submit patches for that?
Conscience is the debugger of the mind

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: [LazFreeType] Patches
« Reply #43 on: February 04, 2013, 12:04:14 pm »
The bugtracker.

Note: while I agree with ask's post, if it makes sense architecturally to move stuff into FPC, I think it should be done. Yes, it will take some time to filter through to Lazarus stable releases but better late than never.

You can then use conditional compilation to check for FPC version in order to support old and new FPC up to the time a new stable FPC is released... or alternatively just live with duplicate code for a while... (which I wouldn't recommend)

Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

circular

  • Hero Member
  • *****
  • Posts: 4194
    • Personal webpage
Re: [LazFreeType] Patches
« Reply #44 on: February 04, 2013, 09:37:16 pm »
If I apply some modifications to the FP code, it is not compiled again, object files stay the same and added functions are not available. How to recompile FP?
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018