Anders Melander 1358 Posted May 22 I'm writing a shaper for complex text layout and for that, I need to do Unicode decomposition and composition (NFD and NFC normalization). Ā Does anyone know of a Pascal library that can do this? Ā I have the following basic requirements: Open source with a workable license (i.e. not GPL). Cross platform (i.e. not tied to Windows or whatever). Operate on UFC4/UTF-32 strings. Based on the standard Unicode data tables. Must have the ability to update tables when new Unicode tables are published. Must support both NFD decomposition and NFC composition. Ā So far I have found the following candidates: Delphi Unicode libraries PUCU Pascal UniCode Utils Libary šµ Origin: Benjamin Rosseaux. ā Maintained: Yes. ā Maintained by author: Yes. ā License: Zlib. ā Readability: Poor. Very bad formatting. ā Performance: The native string format is UCS4 (32-bit). ā Features: Supports decomposition and composition. ā Dependencies: None. ā Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ā Table format: Generated inline arrays and code. ā Completeness: All Unicode tables are available. ā Hangul decomposition: Yes. ā Customizable: Required data and structures are exposed. ā Unicode level: Currently at Unicode v15. ā Unicode normalization test suite: Fail/Crash Ā FreePascal RTL šµ Origin: Based on code by Inoussa Ouedrago. ā Maintained: Yes. šµ Maintained by author: No. šµ License: GPL with linking exception. ā Readability: Good. Code is clean. ā Performance: Code appears efficient. ā Features: Only supports decomposition. Not composition. ā Dependencies: None. ā Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ā Table format: Generated arrays in include files. ā Completeness: Only some Unicode tables are available. ā Hangul decomposition: No. ā Customizable: Required data and structures are private. ā Unicode level: Currently at Unicode v14. ā Unicode normalization test suite: N/A; Composition not supported. Ā JEDI jcl šµ Origin: Based on Mike Lischke's Unicode library. šµ Maintained: Sporadically. šµ Maintained by author: No. ā License: MPL. ā Readability: Good. Code is clean. ā Performance: Very inefficient. String reallocations. The native string format is UCS4 (32-bit). ā Features: Supports decomposition and composition. ā Dependencies: Has dependencies on a plethora of other JEDI units. ā Data source: Unicode tables are generated from official Unicode data files. Source for converter provided. ā Table format: Generated resource files. šµ Unicode level: Currently at Unicode v13. ā Completeness: All Unicode tables are available. ā Hangul decomposition: Yes. ā Customizable: Required data and structures are private. ā Other: Requires installation (to generate the JEDI.inc file). šµ Unicode normalization test suite: Unknown Ā The FPC implementation has had the composition part removed so that immediately disqualifies it and the JEDI implementation, while based on an originally nice and clean implementation, has gotten the usual JEDI treatment so it pulls in the rest of the JEDI jcl as dependencies. I could clean that up but it would amount to a fork of the code and I would prefer not to have to also maintain that piece of code. That leaves the PUCU library and I currently have that integrated and working - or so I thought... Unfortunately, I have now found a number of severe defects in it and that has prompted me to search for alternatives again. Ā Here's the project I need it for: https://gitlab.com/anders.bo.melander/pascaltype2 Share this post Link to post
Lars Fosdal 1485 Posted May 22 Is there Unicode support in @Alexander Sviridenkov'sĀ https://delphihtmlcomponents.com/index.htmlĀ ? Share this post Link to post
Anders Melander 1358 Posted May 22 51 minutes ago, Lars Fosdal said: Is there Unicode support in @Alexander Sviridenkov's https://delphihtmlcomponents.com/index.html ? Doesn't really matter: 2 hours ago, Anders Melander said: I have the following basic requirements: Open source with a workable license (i.e. not GPL).   Share this post Link to post
Fr0sT.Brutal 814 Posted May 23 20 hours ago, Anders Melander said: I could clean that up but it would amount to a fork of the code and I would prefer not to have to also maintain that piece of code. Why not extract only necessary external requirements to custom low-fat units and leave the unit of interest as is? Or there's too much deps? Share this post Link to post
Anders Melander 1358 Posted May 23 1 minute ago, Fr0sT.Brutal said: Why not extract only necessary external requirements to custom low-fat units and leave the unit of interest as is? Or there's too much deps? I guess that's one way to remove the dependencies. I hadn't thought of that. Ā But I would still have to clean up the remaining source and rewrite parts of it, so again: A fork. If I go that way I would probably prefer to simply start from the original, pre-JEDI, version of the source instead of trying to polish the turd it has become. Share this post Link to post