Open type font issue - cairo

Basically,this is a problem of displaying a minority language.
Let me make it brief:
I've been trying to make my Opentype font(which has some features in it) work properly on non-windows(on windows, it works fine) platforms(Android ,iOS etc.).
What I'm truly dealing with is a problem as complicated as displaying Arabic language(including glyph substitution,shaping etc.).
I simply want to display the characters properly in my own software,because system wide support may be even more complicated for me to achieve.
I checked out ICU, Pango, Harfbuzz... and finally decided to work on Pango. See Pango ScriptGallery.
So,here's the questions:
1.Can I use pango as a supportive module in my project to display that language? I tried to install Pango on ubuntu,came with no success.I'm pretty confused now because Pango is related to harfbuzz,cairo,freetype,fontconfig blabla when installing.
2.If can't, is there any other light-weight ways to achieve that ?
Any help will be appreciated .

Which programming language do you use or you should use?
As you question tags, you may have a look at this (the second code), just do a sudo apt-get install python-gtk2 for it, ref
A lightweight solution would be using HarfBuzz directly.

Related

Using OpenType features with ImageMagick or GraphicsMagick

Does anyone know if it's possible to use OpenType features in ImageMagick or GraphicsMagick? Specifically, I'm looking to use glyphs that are not assigned to Unicode points (glyphs are sometimes placed outside of the Unicode range, since they are intended to act as embellishments to other characters). In OpenType-aware desktop applications, you would usually need to open a glyph table and select the glyph manually; I'm not sure how you would do this using ImageMagick.
I'm afraid, such advanced (and also: somehow obscure) OTF features are NOT (yet) supported by ImageMagick -- at least there's nothing in the available documentation (I don't know about GraphicsMagick).
But your best option to get a definitive, authoritative answer from the developers themselves is: register here and ask again on the official ImageMagick Users list.

perl editor/IDE similar to source insight for C

I have recently started working with Perl. Googling reveals a number of editors but I am unable to find an editor that will help me navigate a large body of Perl source code. One of the features that I am looking for is the ability of the IDE to integrate with different modules and allow me to jump from one to another. If possible, it will also help if one can see the which function calls what.
I used source insight for C programming and it provides these very useful features. Am looking for similar features in perl.
Help appreciated
Have you looked at Padre? It is a Perl IDE developed by the Perl community.
I'm just giving EPIC a chance.
http://www.epic-ide.org/
Its an Eclipse plugin utilizing a mighty IDE. The advantage I see in using EPIC over Padre is the fact that eclipse can do all sorts of languages and I don't have to get used to multiple different editors every time.
Another great aproach for Perl programming is using emacs. Yes ... its old but I had quite some joy while getting into Perl.
cu
Roman
Komodo IDE, from Active State is also quite good. I haven't used any other Perl IDEs so cannot make comparisons. Most of the features that you are looking for I believe are available in Komodo.
On a side note: The feature that I most appreciated in Komodo was visual debugging.
I mainly use jEdit for Perl programming.
The PerlSideKick plugin, allows you to navigate huge Perl modules (mainly just a plugin for the SideKick plugin).
But there's not much to give you that easy Shift+click navigation you get from Eclipse. jEdit is 100% programmable through Beanshell macros (and JavaScript and Python and JRuby...). So, you can do some of this yourself. So there would be work involved.
For example, it been close enough for me to create "Selection macros" that will allow certain actions on the package or name either highlighted or at the caret. For example, open up the module indicated by the package name.
The Navigator plugin will at least remember where you were last across files.
You might be able to do cross-module navigation through one of the tags plugins
So this won't get you all the way you'd want to go, but it will get you some of the way, and for $0.
It has the most configurable source highlighting this side of writing Emacs-LISP.
It does FTP and remote editing cleaner than most editors I've used.
You can build up a library of Beanshell (shorthand Java) scripts that really help you get what you want done.
Just remember that this recommendation comes with caveats. I have found EPIC quite sub-standard for my use.

Emacs in the era of IDEs

I am relatively new in a software development. I have noticed that in some cases a text editor with extended text processing capabilities (I use Notepad++) gives me a better productivity than an IDE (I use the Eclipse and the Netbeans). In the era of IDEs, does it makes sense to learn emacs (or some other tool that you suggest?)
Yes, and no.
Yes for the exact same reason why a doctor should be able to get an approximate diagnose from your symptoms by using his experience, and not putting the list of symptoms in a google query and find the answer.
Yes for the exact same reason why airliner pilots are taught to fly without fly-by-wire even if all airplanes are today fly-by-wire, so almost everybody is able to keep them flying.
No, because if you need specific tools to make your life easier, such as GUI designers, Intellisense, access to documentation, then clearly Emacs is not enough.
Still, I remember that many developers at Microsoft organized a fund raising for uganda vim children.
Summing up, you need to use what makes you more productive. In many cases, emacs (or vim) is more productive than a huge IDE that makes coffee.
Even if you were using an IDE, it's still useful to know Emacs/VIM. You don't have your IDE around all the time, and while doing something via SSH, you don't really have any other option (yeah you can use nano, but thats not very effective).
When you do software development, you often deal with a lot of text besides code. I may use an IDE for most of my coding, but often I'll use Vim for plain ol' text viewing and manipulation.
Sometimes I need to view code, SQL scripts, XML, CSV, or TXT files. Other times I may want to perform bulk replacements on those files, or extract out certain chunks of text from it.
IDEs are good for writing and refactoring code, but aren't meant to be used for generic text viewing and manipulation. For that, I'd recommend having the full power of something like Emacs or Vim. Notepad++ can be good too.
In short, use the right tool for the job.
Everyone here seems to think that Emacs/Vim are light-weight compared to IDE's. This couldn't be further from the truth. Even the best IDE's do not have the features that Emacs does. In what IDE's can you program completely without moving your hands from the keyboard, read your email, chat with Jabber, run an integrated debugger, view your calendar, program your own functions, and send dbus commands? That's only the surface of what Emacs allows; I'm sure Vim has similar capabilities.
Ignoring productivity completely; remember why you started programming in the first place. You like to create stuff, you like to know how stuff works, you like creating clever solutions to obscure problems, you like tinkering, you like learning new things, you like creating tools that help you do things.
With this in mind the answer is yes, learn it if you think it will add to the delight to your days. Maybe you will also get some work done along the way. Fiddling with eamcs will not make you melt. You might even make a life-long friend of it. Happy Hacking.
Emacs is an IDE. In fact, you could argue it's a whole operating system.
vi, on the other hand, is an editor.
Yes, it makes sense to learn vi, since it's about the only editor you can use on anything vaguely posix, even if the GUI isn't running or the network is incredibly slow (vi is usable at 300 baud). Basically, it's the unix administrator's safety net of an editor. I've used it to rescue myself from broken device drivers on an OS X server that would only come up so far as single user, so even the must GUIfied Unix out there can still be saved by humble vi.
It makes some sense to learn emacs too, but perhaps not quite so much these days.
I would say it helps to learn emacs (or say vim).
Personally I'm comfortable using IDE (eclipse) for Java developement, when I code in perl or python I prefer to use emacs. Also if you are in a resource constriant environment (say) starting an IDE like Eclipse (which would crawl if there is anything less than 1GB RAM) to write a perl script might not be feasible. In such cases a vim would be neat tool of choice.

How can I enhance the look of the Perl/TK GUI under Perl 5.004?

I have an application that is built to work on Windows, Linux, and Solaris that uses the Perl/TK GUI. Due to constraints, we are limited to Perl/TK only. Moreover, we are limited to an old Perl/Tk version, 5.00404.
I'd like to work within these limitations to make the GUI look as nice and modern as possible.
Are there any web-resources that have TK design schemes (for buttons, frames, colors, etc) that could assist me in this endeavor?
I am also looking for modernization advices like the one that I found here:
If you're finding that your Tk apps look a little ugly on X-based systems, try adding the following lines to the top of your script:
$mw->optionAdd("*font", "-*-arial-normal-r-*-*-*-120-*-*-*-*-*-*");
$mw->optionAdd("*borderWidth", 1);
Try using images instead of button elements, then you can have whatever style you like and the fonts can be baked in. This will work for pretty much any element where the contents are not dynamic - including backgrounds on panes and such. Granted it's more work but it does solve your problem, especially if you have a competent artist in your project group.
You could use the Tk theme engine to give your app better looks.
Using optionAdd to tweak defaults through the option database
is a reasonable start. A thread about this can be found at:
http://tcl.projectforum.com/tk/221
Download griffin.kit from there, use the sdx tool to unwrap it and locate
griffin.tcl to get a good set of option settings.
http://wiki.tcl.tk/3411 for the sdx tool.
Since in Linux the background of Tk::Entry and Tk::Text is grey i would also use the following two lines.
$mw->optionAdd( '*Entry.background', 'snow1' );
$mw->optionAdd( '*Text.background', 'snow1' );
Replace 'snow1' with a color of your choice. You can also use the hex representation(RGB) of the colors like '#ff9696'.
The Tile themeable engine for Tk makes it look much prettier. However, Perl/Tk has lagged far behind Tk's development, and can't take advantage of Tile and other advancements.
You should investigate whether Tkx is an option for you. It's not completely compatible with Perl/Tk, but the API is pretty close. It's a bridge between Perl and Tcl/Tk, so it can use all of the modern Tcl/Tk features (like Tile) while still having application logic coded in Perl. Quite a few of ActiveState's own graphical utilities use Tkx, with fairly good-looking results.
(source: activestate.com)
Perl 5.00404 is incredibly ancient, though. The Tkx dist claims to depend on Perl≥5.008... I don't have an old enough Perl to see how accurate that is.

What is the best Perl module to use for creating a .pdf from scratch?

There are quite a number of modules on CPAN relating to the creation and manipulation of .pdf files, and I'm hoping this community can save me some time going down blind alleys.
I am looking to create .pdf files from scratch, with only simple formatting such as bold/italic and left/right/center justify. Being able to use a template file would nice, from an MVC perspective, but if the best module doesn't support that, I'm ok. I want the best module for my narrow problem set.
Edit: let's add the constraint that it does have to be a Perl module, if not a pure-perl solution. Thanks for answers thus far!
Update: PDF creation is one difficult problem to decide how to approach. In addition to the good suggestions here, there seems to be about 1,000 different ways to solve this, and knowing which solution(s) to invest your time in is a real challenge. It is easy to acquire dependencies on outside executables in the process of building this solution, which is why I have been favoring doing everything in Perl if possible.
I went down the road of trying to use PDF::Create but found it too limiting. You have to give coordinates to place each string of text and there is no built-in concept of text wrapping... this is all work you have to do. Impossible amount of overhead for my task.
I am now using PDF::API2, which is much more powerful than PDF::Create, but still demands the PDF be assembled at a troublingly low level. Luckily, there is some help online. See Rick Measham's excellent PDF::API2 tutorial with accompanying text_block() subroutine, which thankfully does the heavy lifting on the text wrap problem.
Unless you see another update here, this is the solution that ended up working for me.
I'm the author of the CPAN module CAM::PDF which is definitely not the best tool for this job -- it's designed for high-performance editing, not creating.
Among free PDF creation libraries, I like PDF::API2 the best. It has a very rich feature set and good encryption support (inspired by CAM::PDF I might add!) The author, Alfredo, manages a popular email list. People sometimes complain about documentation, but I've found it to be adequate.
Among commercial libraries, I've had good experiences with pdflib.
Three modules for creating PDF come to mind (in no particular order)....
PDF::API2
PDF:::Create
PDF::Template
PDF::Template gives you that template option you maybe hankering for? PDF::Create seems more straightforward (at least from the docs) and may meet your "simple formatting" requirement more adequately.
However if you want to know what the "community" thinks then only PDF::API2 gets a rating on CPAN Ratings coming in with 4 out of 5 stars overall score.
Hope that helps.
PS. Disclaimer: I've not used any of these modules. In past I've always gone for XML/XSLT/XSL-FO using Apache FOP with Perl being used to create the initial XML data. This can be an overkill for something small and not always ideal if you want to embed PDF generation into your Perl app.
PPS. So I'll also be looking at these CPAN PDF modules at some point in near future!
Does it have to be a Perl module? You could always use LaTeX and convert that to PDF. Not quite as straight-forward, but it is another option.
G'day Marcus,
Glad you found the tutorial. I do a lot of work in PDF::API2, so if there's anything I can help with, just let me know.
Naturally, I recommend PDF::API2!
There's a guy Jay Hannah, who's currently turning the text block into a module for CPAN that does exactly what you want: bold, italic, etc. If you check the mailing list, you'll see his posts at the top.
Cheers!
Rick Measham
Yeah, tough to answer without knowing exactly what your constraints are. If pure-Perl is not a necessity, I'd be inclined towards DocBook.
The initial markup you'll generate can be very simple XML; and the transformation requires just an XSL processor and shelling out to something like Apache's FOP.
how to save a online pdf file using perl?
http://www.nwcc.bc.ca/FNC/pdfs/Stepping%20Stones%20to%20improved%20Relationships%20-%20web.pdf
I am using file::download. but the problem is its not downloading url with url encoded strings.
sharma