Recent

Author Topic: Justified, hyphenated and formatted static text  (Read 5251 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Justified, hyphenated and formatted static text
« on: July 07, 2013, 04:45:00 pm »
TMiniStaticText (66Kb package attached)

Summary:

Justification and Hyphenation:
MiniStaticText hyphenates words when control width reaches a size less than 500 pixels. For larger widths it only justifies it. Hyphenation tries to avoid so called "loose lines" and "rivers" of white space caused by justification. Of course hyphenation depends on the quality of the dictionary of your language. Every LineEnding is interpreted as paragraph end.

Formatted Text:
MiniStaticText accepts formatted text through its property FormattedText:
bold, italic,  underline, strikeout, colored text

MiniStaticText has a limit of 10,000 bytes.

Hyphen.pas, hyphen.dll, and hyphenation dictionary (hyph_your_language.dic) must be present on project folder in order of MiniStaticText can work properly. Hyphen.dll must be distribuited along with your program and must be on the path.

Copyright notes:

1) The hyphenation dictionary is from OpenOffice, you can get one to your own language there (http://wiki.openoffice.org/wiki/Dictionaries).

2) The hyphenation DLL and SO files are from Hunspell project (http://hunspell.sourceforge.net/).
"NHunspell is licensed under: GPL/LGPL/MPL. Free use in commercial applications is permitted according to the LGPL and MPL licenses. Your commercial application can link against the NHunspell DLLs."

3) Hyphen.pas is from Theo (http://forum.lazarus.freepascal.org/index.php?action=profile;u=4660

Use TMiniStaticText only if you need a little cosmetic text in you application.
« Last Edit: September 07, 2014, 01:41:02 pm by typo »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Justified, hyphenated and formatted static text
« Reply #1 on: July 07, 2013, 05:10:42 pm »
Here a demo.

(Copy Hyphen.dll and hyphenation dic to its folder)
« Last Edit: August 31, 2014, 06:08:27 pm by typo »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Justified, hyphenated and formatted static text
« Reply #2 on: July 08, 2013, 04:36:13 pm »
Here a screenshot.

typo

  • Hero Member
  • *****
  • Posts: 3051

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Justified, hyphenated and formatted static text
« Reply #4 on: August 31, 2014, 06:15:52 pm »
Quick instructions to run the demo:

1) Install the package on Lazarus IDE.
2) Extract the demo folder from zip file.
3) Copy Hyphen.dll and hyph_en_US.dic to the demo extracted folder.
4) Open and run the demo from Lazarus IDE.

 

TinyPortal © 2005-2018