{"action":"created","issue":{"url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/1913","repository_url":"https://api.github.com/repos/harfbuzz/harfbuzz","labels_url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/1913/labels{/name}","comments_url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/1913/comments","events_url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/1913/events","html_url":"https://github.com/harfbuzz/harfbuzz/issues/1913","id":482587526,"node_id":"MDU6SXNzdWU0ODI1ODc1MjY=","number":1913,"title":"Implementation for Perl?","user":{"login":"PhilterPaper","id":13512500,"node_id":"MDQ6VXNlcjEzNTEyNTAw","avatar_url":"https://avatars3.githubusercontent.com/u/13512500?v=4","gravatar_id":"","url":"https://api.github.com/users/PhilterPaper","html_url":"https://github.com/PhilterPaper","followers_url":"https://api.github.com/users/PhilterPaper/followers","following_url":"https://api.github.com/users/PhilterPaper/following{/other_user}","gists_url":"https://api.github.com/users/PhilterPaper/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilterPaper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilterPaper/subscriptions","organizations_url":"https://api.github.com/users/PhilterPaper/orgs","repos_url":"https://api.github.com/users/PhilterPaper/repos","events_url":"https://api.github.com/users/PhilterPaper/events{/privacy}","received_events_url":"https://api.github.com/users/PhilterPaper/received_events","type":"User","site_admin":false},"labels":[{"id":9383322,"node_id":"MDU6TGFiZWw5MzgzMzIy","url":"https://api.github.com/repos/harfbuzz/harfbuzz/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2019-08-20T00:27:31Z","updated_at":"2019-08-23T16:04:41Z","closed_at":null,"author_association":"NONE","body":"(This was originally sent to the mailing list, but apparently disappeared. Per your suggestion, I'll put it on GitHub)\r\n\r\nI support a Perl library, PDF::Builder, which creates PDFs using OTF and TTF fonts. Currently it can only handle left-to-right simple scripts, and not even ligatures, alternate representations, etc., much less bidirectional or complex scripts such as Arabic and Indic-family writing (e.g., Farsi, Devanagari, Khmer). Anyway, it sounds like HarfBuzz would do what I need: given a list of Unicode characters, select the glyphs, substitute and rearrange as necessary, and provide the final list of character (glyph) IDs with any positioning and size changes needed. I would take care of the rendering (putting it into a PDF file). Help with word break-points, length of text in points, etc. (for paragraph shaping) would be great. Bonus points for simple scripts (Latin, etc.) using a font's ligatures, suppressing selected ligatures, selection of alternate forms and swashes, etc. Is my understanding correct that the current HarfBuzz can also work with TTF files?\r\n\r\nI looked at using Pango, but (besides loading a lot of rendering overhead that I don't need) it requires a lot of manual installation work to build GTK+ and other libraries, before its prereqs can even be installed by the 'cpan' tool (that's what Strawberry Perl calls its tool to build and install CPAN module packages). I need something that can be completely handled by 'cpan', and on ordinary Windows platforms (among others), or potential users will not be interested. 'cpan' can compile and link C/C++ code (gcc and g++ compilers), so long as it's reasonably platform-agnostic. I'm hoping that it would be just a matter of writing a thin wrapper around the HarfBuzz code to provide an interface to Perl. If it would simplify matters, Perl (CPAN) has a Font::TTF library that reads in a TTF or OTF font and loads the internal tables (GSUB, GPOS, etc.) into Perl structures (\"hashes\"). I don't know yet how to get C code to read a Perl hash. At worst, I would have to read in a second copy of the font file in some format usable for HarfBuzz. There _is_ a Font::FreeType library that may be usable by HarfBuzz. Since HarfBuzz libraries (.dll, .a, etc.) seem to not be standard equipment on all Operating Systems, it is not suitable to simply put a wrapper around a .dll or .a file that is presumed to be created elsewhere.\r\n\r\nSo, I've been looking for a Perl-compatible installation of HarfBuzz that could be built on any Perl platform by 'cpan', but haven't found anything. I see a few references to Perl on the mailing list, but these appear to be tools that happen to be Perl. HarfBuzz is big and complex enough that I really don't want to attempt to translate it into pure Perl, unless most of it is reading the file and loading up various data structures, in which case I would just use Font::TTF for that part of it. A pure Perl copy would likely be slower than C/C++, and I would have to scramble to keep up with HarfBuzz updates. A C/C++ version would be easier -- I would just copy over the source code after an update, test it, and release a new version on CPAN.\r\n\r\nDoes anyone have any experience in this area, or know of anyone who's already done this work? PDF::Builder is free, so I would prefer not to require someone to buy a library in order to handle more than very simple scripts. I don't see anything on CPAN or on GitHub, and Google hasn't turned up anything promising. Thanks much for any advice or pointers on this! My platform is Strawberry Perl 5.26 on Windows 10, but whatever it is has to work on a wide range of Perls and platforms. I just want to avoid re-inventing the wheel if someone has already done this! Python can not be assumed, so some test tools and examples might have to be rewritten in Perl. Tools like automake can not be assumed, so I may have to rewrite the Makefile. My next step will be to see if I can at least compile and link the sources, perhaps with a small test driver.\r\n"},"comment":{"url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/comments/524371343","html_url":"https://github.com/harfbuzz/harfbuzz/issues/1913#issuecomment-524371343","issue_url":"https://api.github.com/repos/harfbuzz/harfbuzz/issues/1913","id":524371343,"node_id":"MDEyOklzc3VlQ29tbWVudDUyNDM3MTM0Mw==","user":{"login":"PhilterPaper","id":13512500,"node_id":"MDQ6VXNlcjEzNTEyNTAw","avatar_url":"https://avatars3.githubusercontent.com/u/13512500?v=4","gravatar_id":"","url":"https://api.github.com/users/PhilterPaper","html_url":"https://github.com/PhilterPaper","followers_url":"https://api.github.com/users/PhilterPaper/followers","following_url":"https://api.github.com/users/PhilterPaper/following{/other_user}","gists_url":"https://api.github.com/users/PhilterPaper/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilterPaper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilterPaper/subscriptions","organizations_url":"https://api.github.com/users/PhilterPaper/orgs","repos_url":"https://api.github.com/users/PhilterPaper/repos","events_url":"https://api.github.com/users/PhilterPaper/events{/privacy}","received_events_url":"https://api.github.com/users/PhilterPaper/received_events","type":"User","site_admin":false},"created_at":"2019-08-23T16:04:41Z","updated_at":"2019-08-23T16:04:41Z","author_association":"NONE","body":"> You can use HarfBuzz without any dependency whatsoever.\r\n\r\nI see a lot of \"FT\" macros and function names in the source, including FT_FREETYPE_H, but I don't see them defined locally. Does HarfBuzz assume that FreeType source is present?\r\n\r\nI also see `*.rl` files, but it appears that the corresponding `*.h` files have already been generated. I'm not familiar with the use of Automake (Makefile.am), so I'm not sure if these `*.in` files are input or output (anyway, they don't appear to be supplied). At any rate, that's another tool to be installed. There are `*.py` files in the Make process, so Python will have to be installed, and `*.sh` files, so something like _mingw_ is needed (I have it already with Git). This is getting rather complicated to build -- is there a list someplace of what prerequisite libraries need to be installed first, and what tools will be needed to build (either a minimal HarfBuzz install, or the full package)? There seem to be more and more things needed as I dig deeper. I think that package authors working on a loaded Linux box tend to forget that someone will want to build this thing on a plain Windoze box. If I can preprocess your source to the point of plain C/C++ input (`*.xs` files?), and an ordinary Makefile, this could be feasible as a Perl package, but otherwise I'm not confident."}}
{"actor":{"display_login":"PhilterPaper"}}