I'm looking for a C/C++ library (cross-platform, preferably) to draw text on a bmp image.
I've already looked at EasyBMP, which has a font extension. However, I need to display Arial text - which is not available in EasyBMP.
Suggestions appreciated!
Use QPainter from Qt framework. It's cross-platform and dual licensed(LGPL and commercial)
Related
it seems that cairo can't correctly render text like characters in chinese and arabic. Could anyone tell me how to render these texts in cairo? Can pango with cairo in python render these characters? Thanks!
If you select an appropriate font face, you should be able to draw the texts straightforwardly.
cr.select_font_face('Noto Sans CJK SC')
cr.move_to(100, 100)
cr.set_source_rgb(0, 0, 0)
cr.show_text('好吧')
To list available fonts, type in console:
$ fc-list : family
According to cairo's FAQ, the answer is "use PangoCairo":
[...] you learn that cairo_show_text is part of cairo's "toy" text API. It's fine for quick demos, and for learning how to use cairo, but it's not intended for use in actual applications.
It's not hard to run into some of the limitations of cairo_show_text.
[...]
Fortunately, the pango library exists and does do sophisticated text layout, shaping, etc. and integrates very nicely with cairo. We heartily recommend that "real" applications wanting to display text with cairo use pango to do it.
I for my project require to install a custom font for my program but cannot find the directory to install a new font. Where would I find it?
I have looked everywhere including the recycle bin
Assuming you are referring to Scratch 2, as Scratch 1.4 supports all fonts that are on your computer:
You cannot install a custom font into the Scratch 2 editor. However, you can do the next best thing; import the text. If you need the font in Vector mode (you probably should), you can use an SVG editor such as Inkscape to import the text with 100% quality, as if you had imported the font.
Make the text using the font tool. The positioning doesn't matter, we'll do that later.
Select the text.
Convert it to a path. In Inkscape, click on Path -> Object to Path or use Ctrl+Shift+C to do this. Other vector editors might will be different.
Save as SVG.
In Scratch, import the SVG file as a costume, or into an existing costume.
Move it into position, as you would any other text.
Done.
You cannot install a custom font into the Scratch editor. You'll need to use some graphic software like GIMP to make the words you need, then import the images.
My Netbeans 7.4 claims, it uses Courier New 18pt font:
However, when I set my Notepad++ (and any other piece of software on my Windows 7) to the very same typefaces and font size:
Font clearly looks much bigger.
Can someone enlighten me, what am I missing? How can two programs claim that they use the very same font for text display and display that text it two different heights?
Maybe have you unconsciously made zoom. Try Alt + Mouse Wheel or defined there:
https://blogs.oracle.com/geertjan/entry/scroll_in_netbeans_editor_to
I am using ObjectAid UML Explorer to generate a UML Class Diagram from my code.
I need to include the output PNG in a LaTeX document and what I get is way too low resolution for inclusion.
How can I get higher resolution output from the Eclipse plug-in?
I can see the internal format of a .ucls file is just XML:
<class-diagram version="1.0.10"...
Is there a way to get something more dense than 72dpi or something in a scalable format, say EPS or similar? The target document is > 300dpi so 72dpi does not even come close, unfortunately. Whatever rasterises the XML definition has to accept a trap and a pluggable module?
I need something that plugs into the auto-save mechanism of ObjectAid...
I've found a dirty but easy solution to the problem.
By printing the diagram to a PDF, e.g. with programs like PDFCreator, you gain a vector graphic in the PDF. With a graphics editing program like Adobe Photoshop or Gimp you can raster the PDF to a high quality PNG.
It worked fine for me.
With ObjectAid's Diagram Add-On you can make some customizations regarding the printing scale. There's also the possibility to save the diagrams as SVG image, which you can convert to a high quality pixel image, too.
Did you try to use a cropping/design tool such as snagit which would crop a copy of your computer screen and export it in high definition such as an image or directly paste and copy inside a word document ?
I have the same problem than you for providing documentation of my java code. I use EclipseUML Omondo but the image export is pretty poor too. I now prefer to use specific cropping tool for my image export which is a lot better.
I mean that you create the view you need on your computer screen then crop it and paste it in your documentation. I like to use the snagit's paste and copy feature with Microsoft word.
My favorite tool for cropping my UML diagrams is snagit.
Not possible until ObjectAid implements the feature...
Although it's not glamorous, what I did was go into Window | Preferences | General | Appearance | Colors and Fonts inside Eclipse and set all the text fields to double their size.
This created a larger diagram and the export was therefore in a higher res.
I am currently trying to render small fonts (Tahoma regular 8) using the SWT GC on Windows 7. My problem is, that the last two digits are always very close to each other:
(source: iachelini.de)
I noticed the same effect when drawing beveled strings:
(source: iachelini.de)
According to the javadoc the setAntialias method only relates to non-font drawings. I wonder what other things I could do. To turn Clear-Type off is -unfortunately- no option.
Thanks for your time.
Have you tried GC#setTextAntialias?
I have also win7 and turning off the antialiasing by setAntialiasing(SWT.OFF) is working for me in SWT examples..