Two different fonts in one inline object while creating PDF - pdf

Is it technically possible to use two different font in the same
DrawHTMLTextBox while using Debenu Quick PDF Library 10?
Is it possible with any other libraries which can be used in a PHP
project (Not preferred)?

Currently it is not possible to use two different fonts in the string that you pass to the DrawHTMLTextBox function in Debenu Quick PDF Library. If you want to use a different font for different parts of the string you'll need to use DrawHTMLText instead and change the font using SetHTMLNormalFont prior to each section of the string being drawn.
Using this method you'll need to keep track of the width and height of the text you're drawing yourself but you can do that using the GetHTMLTextHeight, GetHTMLTextWidth and GetHTMLTextLineCount.

Related

Use lualatex in mathplotlib without pgf backend

basically the title is the question:
I would like to use lualatex for all the text handling in a matplotlib plot without using the pgf backend.
I need fontenc package and customized fonts to have identical fonts in plots and in my latex documents but do not want to use the pgf backend.
Is there a hidden option somewhere?
The context is the following: I have a mycommands.sty file where all my defind \newcommand for math are stored. I use some specific fonts for, e. g., \mathscr{p}, which is not possible (small letter) without the fontenc package.
Now I want to use these custom commands in different places (legend, labels, title, ...) in the plot and have them work and look exactly the same as in the document I write and compile with lualatex.
The only point why it is not possible is that matplotlib internally uses pdflatex for the compilation which gives me errors when using fontenc and therefore some of my commands do not work.
Thanks.

Titanium - How to use svg files for fontawesome?

I'm using this widget com.mattmcfarland.fontawesome for fontawesome, but I need to use my Svg files. It's possible by using this widget, or there is other way? and how ?
Solution 1:
There is Ti.SVGView (https://github.com/caffeinalab/Ti.SvgView) and an example at https://github.com/icecandy/TitaniumRenderSVGIconsExample on how to use it. But you need to fork and recompile it if you want to use it with Ti 7.
With the fontawesome Widget you can just use the font. The widget only translates the names to the utf codes, so you don't really need it when you type the codes (e.g. \uf104) into the label.text property.
Solution 2:
You can translate your SVG into a font with e.g. https://icomoon.io/app/ and use it as a normal font. The you just set the font-family to this font and use the codes you asign in icomoon to display your icons

CoreText equivalent for [NSFont fontWithName]

In our app we are storing fonts for custom objects as strings containing the font name (as retrieved from the font panel) and instantiate fonts using
+ (NSFont *)fontWithName:(NSString *)fontName
Now when loading or importing files we'd like to check whether the font name will actually resolve on the current system.
Due to certain design restrictions we need to perform the check in plain old C/C++, i.e. these days using CoreText.
However, there doesn't seem to exist an equivalent CoreText API call working similarly to fontWithName::
CTFontCreateWithName always returns a font as it uses a fallback strategy
CTFontCopyFullName appears to use different names than wha is accepted/used by NSFont..?
So basically the question is:
How can we use CoreText functionality to check whether a font exists on the current system and the font can be instantiated successfully using [NSFont fontWithName:] later..?
It appears that CTFontCopyPostScriptName() will always return a valid result for any string that is understood by [NSFont fontWithName:] - and vice versa.
At least in my experiments across 10.8 - 10.10 and using valid and made-up font names the results of CTFontCopyPostScriptName() could always be used to verify a font name will be valid for NSFont.
Edit #1
Some experimentation shows that it's a good idea to also add a fallback with CTFontCopyFamilyName() to be on the safe side.

how can I define strings in resource file and use them in qml

I want to define a number of xml formatted strings in resource file and use the strings in qml code. Is it possible? How to do it? I would be really appreciated any example.
As I know there is no way to store strings in resource file. But you still do that in another way.
First way: create language file with qt translation tool. As bonus you can store string in several languages.
Using in QML is very easy:
Text {
text: qsTr("myTextId");
}
See that link for more info.
Second way: store each string in different resource file.
But in this case you need to extend QML with C++ plugin to get ability to read files.
See that link for more info.

How to use PDFMarkedContentExtractor class from pdfbox library?

I use pdfbox library to extract text from arbitrary PDF file. And I want to know how can I extract some particular text from pdf using this library.
As I understand, I should use marked content feature for this task.
There is the PDFMarkedContentExtractor class. Using its getMarkedContent method I can get PDMarkedContent object, and then, by using method getContents, I can get a real content that I need.
Am I right?
Well, but how can I specify what the document PDFMarkedContentExtractor should use as a source?
To my understanding, PDFMarkedContentExtract is used specifically for tagged contents within the PDF. Based upon your comments and your description, I believe you just want to extract the text in general. If that's the case, I believe you need to use PDFTextStripper instead.