Fontnames containing comma in one context and hyphen in another - itext

If I create a PDF using Acrobat Professional 9, containing a single sentence and make that sentence "Georgia Bold", then save, I end up with a PDF that references the font "Georgia,Bold".
If I then take that font from c:\windows\fonts\georgiab.ttf and interrogate it using the following code and itext 4.2, I end up with a font name of "Georgia-Bold"
String path = "georgiab.ttf";
BaseFont baseFont = BaseFont.createFont( path, BaseFont.WINANSI, BaseFont.EMBEDDED );
System.out.println( "Font " + baseFont.getPostscriptFontName() + " found in " + path );
I'm trying to determine why when used in a PDF file, the font name has a comma whereas when used outside of a PDF file, the font name has a hyphen.

The name that you get from getPostscriptFontName() is the actual name within the font file. For a TrueType font this is parsed in the BaseFont method of TrueTypeFont.java (line 498 in 5.1.1.3).
Why does Adobe use a comma? That's just what they decided to use. If I were to guess they probably chose the comma because some fonts use hyphens in their name but most (if any at all) never use a comma. So instead of My-Awesome-Font-Bold they chose My-Awesome-Font,Bold. Users can tell that they're using a bold variant of a font instead of just a font that happens to have the word "bold" in it.

Related

TinyMCE editor does not keep the font family format when copy-pasting from an external document

Even though I've set the parameter paste_enable_default_filters = false, seems like there is a bug in TinyMCE editor or I'm missing something. It actually keeps most of the text format when I paste a text from an external document.
However, I've a text in a Word document; it's in Times New Roman format. But when I copy-paste it into the editor, it only paste 1 line as Times New Roman, the rest is has been formatted to the default font family.
Why is this happening, why it only paste 1 line as in Times New Roman format while the rest is also in Times New Roman format? I'm open to any ideas.

Is it possible and if so, how to bind font glyphs to all keyboard ALT+sign button combinations?

I'm trying to create runic style font without meaning in any language, using FontForge.
I want it to have three to four slighty different base looks per glyph, with an option to modify them with kerning.
Is possible to assign all or part of keyboard glyphs buttons (eg.: q, w, e, t, r, ..., 1, 2, 3, ... , [, ], , ;, ', ...) to work in most text editors for keyboard combinations:
button
SHIFT + button
ALT + button
ALT + SHIFT + button
First and second can be done with just auto generated unicode versions in FontForge.
For third and fourth i have only few symbols working in my computer (Polish language) ę€óąśłńćźżĘÓĄŚŁŻŹĆŃ, so i can add their equivalents to font.
Is somewhere list of unicode numbers matching others ALT+keyboard glyph combinations?
Is needed to do something more to do like defining font language or application/system language to make it work?
Or another approach is possible to take?
Im using Windows 10 as a system and as i found correct answer to my problem is in two parts:
Create custom encoding in FontForge:
a) Custom Encodings file location: $Disk$:\Users\$Username$\AppData\Roaming\FontForge\Encodings.ps. As it is in AppData folder wise is to have its backup somewhere else. Example of custom encoding:
/fontname [
/1
/exclam
/2
/at
/3
/numbersign
/4
/dollar
/n
/nacute
/N
/Nacute
/m
/M
] def
b) Use some FontForge encoding creation options:
Save encoding to file, basing on currently active font (point a) location): Encoding->Make From Font.
Load pre-defined encoding (last ones are custom, if exists): Encoding->Reencode.
Remove not existing glyphs: Encoding->Compact (remove not existing glyphs)
Remove not existing glyphs and sort them: Encoding->Reencode
Check glyph names for FontForge in Glyph info or Glyphs editing options.
Download Microsoft Keyboard Layout Creator and use it to add matching keyboard layout to font glyphs, then add it to system layouts in system settings.

is there any way to use 'ə' letter in input field?

I want to write 'Ə' letter on the TMP inputField but it recognize that letter as '?' symbol.And also when I copy and paste that letter to the InputField it works but when I try to insert it from keyboard it does not work. Is there any way to use that letter?
Use TextMeshPro input field instead default input field.
This new version includes Dynamic SDF support where it won't be necessary to add the needed characters to the font asset (ahead of time) via the Font Asset Creator. Instead the needed characters / glyphs can be added dynamically to a newly created font asset in the Editor or at Runtime.
You will still need to create a font asset from a font file that contains the Azerbaijanian character set.

How can I make my custom font support on bold or put multiple fonts?

I want to use in my project text view with the custom font- heebo.
but I have a problem when I run my app all the bold word is not bolded
and everting is hebbo regular, how can I fix it or make this font to be multiple?
another solution is to write a function that takes the text inside of the text view and detect if its bold or regular and if its bold I put heebo-bold.ttf and if not I put heebo-reguler.ttf so if somebody helps me with that it will be good.
I downloaded the very same font you're trying (Heebo bold) and I've done the next steps:
Install font on the system (double click on .ttf file)
Copy the font to your project folder on xcode. (Make sure you're checking Copy items if needed and add to target 'your target' check boxes)
Add hebo-bold.ttf to your info.plist under "Fonts provided by application" (as in next image)
Build (cmd + B)
Use font from storyboard or by code:
yourLabel.font = UIFont(name: "Heebo-Bold", size: 18.0)
When you want to know the exact name a font has (when setting it by code you need this name not the filename like 'heebo-bold.ttf') you can use these couple of lines:
print(UIFont.familyNames)
print(UIFont.fontNames(forFamilyName: "familyName"))
First line will print the names of all family fonts available.
Second line will tell you the specific name you'll have to use on UIFont(name: String, size: CGFloat) (i.e. Heebo-Bold, Heebo-Italic, etc)

Russian characters not showing up correctly in MFC unicode list box

I have an MFC application compiled with MBCS set.
I have created a unicode list box on a regular MBCS dialog using the following code:
DWORD dwStyle = WS_CHILD|WS_VISIBLE|WS_VSCROLL;
hLangListBox = CreateWindowExW(WS_EX_CLIENTEDGE, //extended styles
_T(L"listbox"), //control 'class' name
L"Language", //control caption
dwStyle, //control style
10, //position: left
10, //position: top
200, //width
100, //height
GetSafeHwnd(), //parent window handle
//control's ID
reinterpret_cast<HMENU>(static_cast<INT_PTR>(ID_LANGUAGE_ENGLISH+20)),
AfxGetInstanceHandle(), //application instance
0);
When I inspect this dialog using Spy++ I see my Window Proc: has (Unicode) so I believe it is being created correctly.
I am populating the listbox with one of the following commands depending on if I have the data in a unicode string or a regular string
CStringW m_LanguageNames[MAX_LANG];
CString sFilename;
....
::SendMessageW(hLangListBox,LB_INSERTSTRING ,nMenuPos,reinterpret_cast<LPARAM>(theApp.m_LanguageNames[i].GetBuffer()));
::SendMessage(hLangListBox,LB_INSERTSTRING ,nMenuPos,reinterpret_cast<LPARAM>(sFileName.GetBuffer()));
Things look ok for most entries,
I can see
Chinese: 中文(简体)
French: Française
Japanese: 日本
but Russian looks like a P followed by a bunch of bars (P||||||), not Pусский. When I look at the contents of the CStringW in Visual Studio I do see the correct text.
Why can I see the other languages correctly and not russian? I am running on Windows 7 ultimate and compiling with Visual Studio 10
Edit
If I change my system locale to Russian I can see the russian characters fine. However, the ç in Française does not appear correct.
I thought unicode strings were independent of the system locale. Is that correct?
To populate my unicode CStringW I am doing:
CA2W tmp_wide(po.msgstr,CodePage);
m_LanguageNames[i] = tmp_wide;
where po.msgstr is a CString that was read in from a file. In this case, CodePage is set to 1251
If I inspect the variables in Visual Studio it appears that the conversion is happening correctly.
It appears that my unicode list box can display unicode characters from a MBCS such as Chinese fine, but that it can't display unicode characters from a SBCS that is different from my current code page.
Same problem, solved after a long time.
In my case the default font of dialog is set to "MS Sans Serif", just change to use the more recent font "Microsoft Sans Serif" and everything is resolved!
I have not solved this yet, but I think it is likely this is a font issue. I'm not going any farther with this, but the next step would be to have an owner drawn list box and specify an appropriate font for each language