I want to collect font information of a pptx with the help of Apache POI.
I basically search for string typeface= in the xmlObject of a powerpoint slide.
In some of my files, I can see a bunch of lines that contains the search string:
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
But if I check the file property dialog box, I can only see these fonts
There is no +mn-lt or +mn-ea
My questions:
Where do font faces like +mn-ea and +mn-cs come from?
The meaning of
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
is as follows:
For latin text use first (default) given typeface in theme which is found there in minorFont - latin = +mn-lt:
For example \ppt\theme\theme1.xml:
...
<a:fontScheme name="...">
...
<a:minorFont>
<a:latin ... typeface="..."/>
<a:ea ... typeface="..."/>
<a:cs ... typeface="..."/>
...
</a:minorFont>
</a:fontScheme>
...
Per default this will be Calibri.
For east asian text use first (default) given typeface in theme which is found there in minorFont - ea = +mn-ea.
For complex script text use first (default) given typeface in theme which is found there in minorFont - cs = +mn-cs.
OOXML schemes can have major fonts and minor fonts. Usually, major fonts are used for styles such as headings, whereas minor fonts are generally applied to body and paragraph text.
If typeface="+mj-lt" would be given, this would mean majorFont - latin in theme.
Related
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb} \usepackage[square,numbers]{natbib} \usepackage{graphicx} \usepackage{hyphenat} \usepackage{mathptmx} \usepackage{tgtermes} \usepackage{parskip} \usepackage[arrowdel]{physics} \usepackage{multicol} \usepackage{fontspec} \usepackage{tocloft} \usepackage{ragged2e} \usepackage[english]{babel} \usepackage{geometry} \setmainfont{Times New Roman} \newgeometry{top=2.5cm, right=2.5cm, bottom=2.5cm, left=3.5cm} \setlength{\columnsep}{1cm} \renewcommand\cftloftitlefont{\Large} \renewcommand\cftfigfont{\Large} \renewcommand\cftfigpagefont{\Large} \linespread{1.25} \pagenumbering{roman} \date{} \title{\textbf{\Large ELECTRONIC AND MAGNETIC PROPERTIES OF HALF HEUSLER ALLOY CoMnSb}}`
I want title of my all pages to be 16pt (here \Large with \documentclass[12pt] gives me 17pt title fontsize for ELECTRONIC AND MAGENTIC PROPERTIES OF HALF HEUSLER ALLOY CoMnSb)
I am trying to convert .doc file to PDF,
For this I am initially trying to convert .doc > XSL-FO > PDF.
On Converting the .doc to XSL-FO I am unable to convert the drawn objects such as checkbox,rectangle,square to XSL-FO.
It gets converted as below , which should actually be a box
The conversion code I am using is
HWPFDocumentCore wordDocument = WordToFoUtils.loadDoc(is);
WordToFoConverter wordToFoConverter = new WordToFoConverter(
XMLHelper.getDocumentBuilderFactory().newDocumentBuilder().newDocument());
wordToFoConverter.processDocument(wordDocument);
File foFile = new File("D:\\Testing\\testing\\" + "test.fo");
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamResult streamResult = new StreamResult(out);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.transform(new
DOMSource(wordToFoConverter.getDocument()), streamResult);
String result =
org.apache.commons.lang3.StringUtils.normalizeSpace(java.text.Normalizer.normalize(new
String(out.toByteArray(), "UTF-8"), java.text.Normalizer.Form.NFD));
result = URLEncoder.encode(result, "UTF-8");
Further Apache FOP is used to convert the .fo to pdf
The .doc file is as below
and the WordToFoConverter converted the boxes as below
In Plain Text like XML, check boxes usually come from basic symbol fonts.
They are seen / shown as ☐ when unchecked, or ☑ or ☒ when checked.
In any basic text stream it should be relatively easy to use or find and replace them. However beware the encoding especially UTF , thus best copied from a clean set of Zapf Dingbats or Adobe TTF Symbol font.
many have a Unicode description but do test visually that they work after copy and paste from the PDF since the font mapping may not always tally.
8999 ⌧ ⌧ \002327 0x2327 X in a rectangle box
By far the simplest way to use UniCode text is as Rich Text which you can on Windows Command Line (you don't need the lower left dialogue, its just to illustrate export settings) outPort as Port-AbleDocFile using Write.exe which can read TXT and /PrintTo PDF.
Its much simpler than XML where just one character requires:-
<w:rPr>
<w:rFonts w:ascii="Segoe UI Symbol" w:hAnsi="Segoe UI Symbol" w:cs="Segoe UI Symbol" w:eastAsia="Segoe UI Symbol"/>
<w:color w:val="auto"/>
<w:spacing w:val="0"/>
<w:position w:val="0"/>
<w:sz w:val="48"/>
<w:shd w:fill="auto" w:val="clear"/>
<w:vertAlign w:val="subscript"/>
</w:rPr>
<w:t xml:space="preserve">☑</w:t>
i have this
DISCLAIMER:Next Vision Research Solutions Pvt. Ltd. holds the right of refusal/cancel/acceptance of the junk responses either intentionally or unintentionally submitted by anyone and Next Vision Research Solutions Pvt. Ltd. will not be held liable to pay for any such junk responses. Payment shall be made only after ensuring the quality /authenticity on certain parameters of the submitted responses. We are bound to ensure 100 % quality across India with zero tolerance on fudging.नेक्स्ट विज़न रिसर्च सॉल्यूशन्स प्राइवेट लिमिटेड किसी भी प्रकार के जाने या अनजाने में डाले गई गलत प्रतिक्रियाओं को स्वीकृति ना देने का अधिकार रखते है एवं ऐसे किसी भी गलत प्रतिकियॉ का कुछ भी भुगतान करने के लिए बाध्य नहीं है।"
and i want to show this in single text view but in different color like DISCLAIMER: is in red color and other remaining text in black color.
is it possible without using more text view?
please if any possible solution is there tell me.
You can use Spannable to achieve your desire effect.
TextView textView;
String sampleText = "This is <font color='#ff0000'>DISCLAIMER:</font>. Rest of your text or <font color='#00ff00'>Green color</font>.";
// You can use color='red' or color='green'
textView.setText(Html.fromHtml(sampleText), TextView.BufferType.SPANNABLE);
Edit
Define a string in string.xml
<string name="sample_text" formatted="false"><![CDATA[
<font color=\"red\">DISCLAIMER:</font>
<font color=\"#000000\">
Rest of your text in black color
</font>.
]]></string>
Inside your activity/fragment class
TextView tvSample = /*initialize your text view*/;
String text = getString(R.string.sample_text);
tvSample.setText(Html.fromHtml(text), TextView.BufferType.SPANNABLE);
I have both the "5.1 Reference Manual" and the "Programming in Lua: 3rd Ed." in front of me. Reading these, as well as numerous searches on the web, still leave me a bit confused when it comes to using string.match and string.gmatch.
I understand that they both are used to locate patterns.
Here are an example they use in the "Reference Manual" for string.gmatch:
s = "hello world from Lua"
for w in string.gmatch (s, "%a+") do
print(w)
end
I understand that this will iterate over all of the words in s and print them each one per line.
Here is an example they use in the "Programming in Lua" book for string.match:
date = "Today is 17/7/1990"
d = string.match(date, "%d+/%d+/%d+")
print(d) -- prints 17/7/1990
What I'm confused about is when is it appropriate to use one over the other?
For example, you had code you wanted to parse that had contained the same pattern dozens of times throughout it. This pattern contained variables you needed, which would be a better choice? Example code below (x's are all variable data that differs from the other lines. data can be any garbage you didn't care about looking for and it was all just noise):
Header contains variable (HERE) and (HERE) I want.
data data data data data data data data
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
data data data data data data data
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
data data data data data data data data data
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
data data data data data data data data data data data data data data data data data data data data data data data data
<Font Typeset:xxxx Font Color:xxx Font Xpos:xxx Font Ypos:xxx Font Bold:X Font Uline:X Font Italic:X Font Text:XXXXXXXXX>
Footer here also has three variables I want (here)/(here) and (here)
This code obviously has a pattern to it. But, if wanted to create a simple function that parsed the data and grabbed the variables, which is the better choice?
function match(data)
local f_type, f_color, f_xpos, f_ypos, f_bold, f_uline, f_italic, f_txt = data:match("<Font Typeset:(.-) Font Color:(.-) Font Xpos:(.-) Font Ypos:(.-) Font Bold:(.-) Font Uline:(.-) Font Italic:(.-) Font Text:(.-)>
print(f_type, f_color, f_xpos, f_ypos, f_bold, f_uline, f_italic, f_txt)
end
...or...
function gmatch(data)
local f_type, f_color, f_xpos, f_ypos, f_bold, f_uline, f_italic, f_txt = data:gmatch("<Font Typeset:(.-) Font Color:(.-) Font Xpos:(.-) Font Ypos:(.-) Font Bold:(.-) Font Uline:(.-) Font Italic:(.-) Font Text:(.-)>
print(f_type, f_color, f_xpos, f_ypos, f_bold, f_uline, f_italic, f_txt)
end
Does gmatch just iterate over the entire code (data in this example) and return all instances where the pattern is true where match only does the first?
In what scenarios is one better than the other?
ETA: I added a header and footer to the example code. This header and footer both contain variables I want to use. Now this entire chunk of code (header/body/footer) are repeated numerous times throughout the same input file that I want to parse. So there are patterns within patterns.
Does gmatch just iterate over the entire code (data in this example) and return all instances where the pattern is true where match only does the first?
It returns an iterator for doing so.
Returns an iterator function that, each time it is called, returns the next captures from pattern (see §6.4.1) over the string s. If pattern specifies no captures, then the whole match is produced in each call.
In what scenarios is one better than the other?
string.gsub is best when you need to substitute the matches without regard to their position.
string.gmatch is best when you are only interested in the matches, and want to iterate over them.
string.match gives you all the captures from the first match.
string.find is the most versatile, returning the first match and its position. The cost is not being specialized for any task, thus needing more code.
I know this Question has been asked several times before, and I have tried all the steps mentioned but still it does not work for me :(
I have font file name "spyv3b.ttf". I added it to my project, added its name in info.plist file as "spyv3b.ttf". Also it is copied to Bundle Resource. I installed this font in font book and there it is named as "Spylord Bold". I checked in my project by:
NSLog(#"%#",[UIFont FontWithName:#"Spylord Bold" size:22]);
it is returning null. Can anyone tell me where can I be mistaken? Thanks a lot in advance for help.
It is quite easy but little tricky one. Follow the listed steps:
Add fonts .ttf files int your project under the head of "Resources"
Add all the font details in your project info.plist file.
Check your required font is available in Xcode font family with NSLog(#"%#",[UIFont familyNames]);
Output on console:
2012-08-12 07:49:27.278 Quiz[1134:c07] (
Thonburi,
"Snell Roundhand",
"Academy Engraved LET",
"Marker Felt",
"Geeza Pro",
"Arial Rounded MT Bold",
"Trebuchet MS",
Arial,
Marion,
"Gurmukhi MN",
"Malayalam Sangam MN",
"Bradley Hand",
"Kannada Sangam MN",
"Bodoni 72 Oldstyle",
Cochin,
"Sinhala Sangam MN",
"Hiragino Kaku Gothic ProN",
Tahoma,
Papyrus,
Verdana,
"Zapf Dingbats",
Courier,
"Hoefler Text",
"Euphemia UCAS",
Helvetica,
"Hiragino Mincho ProN",
"Bodoni Ornaments",
"Apple Color Emoji",
Optima,
"Gujarati Sangam MN",
"Devanagari Sangam MN",
"Times New Roman",
Kailasa,
"Telugu Sangam MN",
"Heiti SC",
Futura,
"Bodoni 72",
Baskerville,
"Chalkboard SE",
"Heiti TC",
Copperplate,
"Party LET",
"American Typewriter",
AppleGothic,
"Bangla Sangam MN",
Noteworthy,
Zapfino,
"Tamil Sangam MN",
"DB LCD Temp",
"Arial Hebrew",
Chalkduster,
Georgia,
"Helvetica Neue",
"Gill Sans",
Palatino,
"Courier New",
"Oriya Sangam MN",
Didot,
"Bodoni 72 Smallcaps"
)
Check the exact name of your font in the font-family with NSLog(#"%#",[UIFont fontNamesForFamilyName:#"Tahoma"]);
Output on console:
2012-08-12 07:49:27.280 Quiz[1134:c07] (
"Tahoma-Bold"
)
Use the font with the name shown after NSLog(#"%#",[UIFont fontNamesForFamilyName:#"Tahoma"]);
lblQuizName.font = [UIFont fontWithName:#"Tahoma-Bold" size:64.0];
Happy Coding :)
I had a very weird problem - the one i guess no one will ever have.... My every step from start to end was OK.The problem was due to the presence of two app-Info.plist files...! I don't know when did I added the second one. After deletion of one plist file, when i still didn't made it, I created new project, added my previous project files to it and repeated all the steps for adding custom fonts.
Now everything is fine :)