On Fri Aug 02 11:28:59 2019, PMPERRY wrote:
Show quoted text> Hi Brian, thanks for getting back to me on this.
>
> Unfortunately, what you seem to be telling me is that the use of
> HarfBuzz and/or Pango is going to be a lot more complicated than
> simply requiring it (optional prerequisite) in my package
> (PDF::Builder), and 'cpan' happily installs it for anyone as a prereq.
All Gtk-Perl modules (Pango/Cairo/GTK2+/GTK3+/Glib) need the corresponding C libraries (libpango, libcairo, libgtk2/3+/libglib), and their dependencies (libharfbuzz in the case of libpango) installed on the system before the Perl modules will compile.
Show quoted text> While I could probably figure out a way to do it, requiring manual
> GTK+ installation first is probably going to be a deal-breaker for
> most users. Unless I'm misreading your statements and it's actually a
> lot simpler than I fear, it's going to be too much for most potential
> users, and they'll just go elsewhere to get their PDF generation with
> complex scripts.
It will be a lot of work to document and/or compile the GTK+ C libraries (+ dependencies) on Windows. You may be able to find compiled versions of the GTK+ C libraries for Windows on the GTK website, but no guarantees.
Show quoted text> As I said before, I don't need all the rendering stuff that comes with
> Pango; only the glyph selection/ordering/positioning provided by
> HarfBuzz. Is the Cairo code all rendering? Is that what's using GTK+
> (Gtk3 on CPAN)? It would be a shame to put PDF::Builder users through
> all sorts of extra effort to get GTK+ and possibly other prereqs
> manually installed, and then ignore all that new stuff.
>
> I think I have at least three options:
>
> 1. Bite the bullet and work out clean installation instructions that
> will apply to all OS's and Perl distributions, and hope that users
> will be willing to put up with the extra work. I have only a Win10 box
> and only Strawberry Perl, so it would be difficult to test other
> installations.
For what it's worth, VirtualBox is free and runs on Windows 10, most Linux distros are free, so you *could* test on other platforms besides Windows.
But to answer the question you asked, it would be a lot of time for someone to set up Gtk-Perl on Windows in order to get access to Harfbuzz C library functions.
The Gtk-Perl project does not currently have a Windows installer for the C libraries that are required in order to run Gtk-Perl on Windows. Like I said in my previous reply, other people have done it and documented it, but running Gtk-Perl on Windows is not as easy as installing Linux then installing the Perl modules and C libraries via a package manager.
Show quoted text> 2. Talk to the HarfBuzz developers and see if a thin Perl wrapper
> could be put around the library, so I can call it (analagous to
> Graphics::TIFF wrapper around libtiff.a). Something would have to be
> done about building HarfBuzz itself, that would work across all
> platforms).
That's not a trivial amount of time that you're asking of someone else for your project. Yes a thin Perl wrapper can be put around the Harfbuzz C library, but I can't guarantee someone else will do it for you.
Show quoted text> Does Pango installation build HarfBuzz from C/C++ sources?
"Pango" is the Perl module, "libpango" is the C library. If you get these confused, you will cause yourself and anyone you ask questions of endless amounts of grief.
"Pango" the Perl module knows nothing about Harfbuzz; the libpango C library *does* know about the Harfbuzz C library, and makes calls into the libharfbuzz C library as needed to perform text rendering functions. So this means that in order for the libpango C library to work, it also needs a copy of the libharfbuzz C library installed and linked on the same system. The Pango Perl module just makes calls to the libpango C library. This is true regardless of what operating system you are trying run your Perl or C libraries on.
Show quoted text> If you already build it as a standalone .a or .dll library, would YOU
> be interested in providing a Perl wrapper around it, possibly as a
> separate CPAN module? Not having looked at the code, I have no idea if
> this is a large task. I'm quite willing to help out with the C coding,
> if there are some guidelines on how to do it. I see that my MiKTeX
> installation seems to have a HarfBuzz .dll file, so it can be done
> (but I can't require a MiKTeX installation as a prereq).
Please see the above for an explanation about libpango/libharfbuzz dependencies, and how the Pango Perl module doesn't know about Harfbuzz.
You could steal/borrow a Harfbuzz C library Windows .dll file from another project, but you would still need to wrap it somehow in order to talk to it from Perl.
Personally, I'm not interested in writing a Harfbuzz Perl module, I don't have the desire and time for it. As far as coding guidelines, there are many "wrapper" Perl modules on CPAN that you can use as examples for writing a Harfbuzz Perl module.
You may want to create a project for a Harfbuzz Perl module, then ask on the Gtk-Perl or harfbuzz mailing lists for volunteers to collaborate with you on this.
Show quoted text> 3. Rewrite HarfBuzz as a pure Perl solution. That sounds like a lot of
> work, and I'm not anxious to invest the time. Plus, it's likely to be
> noticeably slower than a C solution, and I would be responsible for
> keeping such a module updated as HarfBuzz evolves.
You could also write a HarfBuzz Perl module yourself that wraps the C libraries via XS, as I've mentioned a few times above.
So to answer the question you originally posed in this ticket, the Pango Perl module will more than likely not do what you want, you are probably better off writing a wrapper to the Harfbuzz C library, or implementing Harfbuzz in Pure Perl. I personally am not interested in doing this work for you, but feel free to ask on mailing lists to see if you can get some help.
Do you need anything else for this ticket?