X11 programming font - x11

I'm new to X11 programming, and development is in Linux Environment, i have come across an issue with font which I'm not familiar.
Here is my question:
How to change the character set in XmStringCreate(text,charset) in X11 ?
For Example:
XmStringCreate(text,charset) has the value XmStringCreateLtoR(text,XmString_DEFAULT_CHARSET)
I want to change the DEFAULT_CHARSET to ISO859-15.
And How to handle the XmString_DEFAULT_CHARSET.

The second argument to XmStringCreate is a string associated with a specific font via a fontlist resource, which any widget capable of displaying text has.
If you only need to display ISO8859-15, just put ISO8859-15 font(s) in your fontlist resource, and you're done.
If you need to display more that one legacy charset, put several fonts in your fontList and associate a tag with each one.
*fontList: -b&h-luxi sans-bold-o-normal--0-0-0-0-p-0-iso8859-1:charset1,
-b&h-luxi sans-bold-o-normal--0-0-0-0-p-0-iso8859-15:charset2
Use "charset1" or "charset2" as the second argumnt to XmStringCreate.

Related

transform a svg into a copy/paste-able emoticon like this one 🦄

Not sure if SO is the best place for this question, but don't know where else to ask.
Is there any way to transform a svg like this one for ex: (https://svgsilh.com/image/1775543.html) into something that i can use inside an editor with copy/paste like this one? 🦄
No, because the unicorn emoticon is one example of a character. And just as with letters, digits, and punctuation, the appearance of emoticons and other plain-text symbols is decided by fonts.
LSerni wrote the following:
The reason you can "copy and paste" that icon is that the icon already has a UTF-8 code and your editor is UTF-8 aware. And this is why the same emoticon is slightly different between Apple, Android and so on: it's because it's always code XYZ, but code XYZ is rendered with different icons on different platforms.
But that's not entirely correct. The difference in rendering lies more in the font than in the operating system that displays emoticons. Unless the font supplies its own version of a symbol, that symbol will usually be supplied by the font specified by default by the operating system, and different operating systems supply different symbol fonts.

How can I get the original font name of some text using PDFKit?

I wrote a script which parses information from PDF files and outputs it to HTML. It's written in Python, using pdfminer.
On some text segments, the font style can have semantic significance. For instance: bold, italic and color should trigger different behavior. Pdfminer provides scripts with the font name, but not the color, and it has a number of other issues; so I'm working on a Swift version of that program, using Apple's PDFKit, to extract the same features.
I now find that I have the opposite problem. While PDFKit makes it easy to retrieve color, retrieving the original font name seems to be non-obvious. PDFSelection objects have an attributedString property, but for fonts that are not installed on my computer, the NSFont object is Helvetica. Of course, the fonts in question are fairly expensive, and acquiring a copy just for this purpose would be poor form.
Short of dropping to CGPDFContentStream (which is way too big of a hammer for what I want to get), is there a way of getting the original font name? I know in advance what the fonts are going to be, can I use that to my advantage?
PDFKit seems to use the standard font lookup system and then falls back on some default, so this can be resolved by spoofing the font to ensure that PDFKit doesn't need to fall back. Inspecting the document, I was able to identify that it uses the following fonts (referenced with their PostScript name):
"NeoSansIntel"
"NeoSansIntelMedium"
"NeoSansIntel,Italic"
I used a free font creation utility to create dummy fonts with these PostScript names, and I added them to my app bundle. I then used CTFontManagerRegisterFontsForURLs to load these fonts (in the .process scope), and now PDFKit uses these fonts for attributed strings that need them.
Of course, the fonts are bogus and this is useless for rendering. However, it works perfectly for the purpose of identifying text that uses these font.

Firefox: Cannot display character in input field but can display it within <p>

Firefox can display the following character in div but cannot display it in input.
龗    滙 羣 邨 埗    衞
There are two issues here. First, Firefox (like browsers in general) uses a specific default font for input element (though this font depends on user settings). That font may well lack glyphs for some characters that are present in the font used for normal text (whether as per browser defaults or as per your CSS settings). This can be handled by setting the font-family for input elements suitably. To set it the same as the normal text font, you can use the following CSS rule:
input { font-family: inherit }
Second, your data contains Private Use code points such as U+F5D0. They have absolutely no meaning outside of private agreements on their use. In HTML, they are typically used in conjunction with privately-encoded “icon fonts” that have fancy icons placed in those code points, though they might also be used e.g. for rare Chinese characters (typically occurring in proper names only) that have not (yet) been encoded as characters in Unicode.
This means that such a specific font must be used to make any sense of the content. To make things work across devices, this should be a downloadable font specified with #font-face. If you have done that, simply declare that same font for input elements in CSS.
The browser shoule be able to display HKSCS if the Font set as 細明體_HKSCS, MingLiu_HKSCS, PMingLiU or MingLiU.
I tested in Firefox, Internet explorer and Chrome.

Implementing Emoticon in windows store chat

I am developing a Windows Store chat app.
In this apps, I am using a TextBox to receive message content from the user. I want to implement Emoticons (Smileys) such that typing a code gives a respective image inline with the text.
For example, for :), I want to have a 'smile' image.
What you'll need to do is use a RichTextBlock to display your text. This will give you access to a adding in an InlineUIContainer block where necessary.
So, your process will be:
Accept text in a regular text box
Parse the text into a series of Inlines (Run, InlineUIContainer, etc)
Create a new Paragraph for the message
Add the Inliness to the Paragraph.
Add the Paragraph to your RichTextBlock's Blocks property (a BlockCollection).
For each piece of text:
Split the text, likely using Regex, searching for the keys which trigger an Image (':)', '(heart)', etc).
For each non-image text, create a Run with the Text set to the text of the split
For each Image, create an InlineUIContainer and an Image. Set the Image source to the proper Image path, then set the Child of the InlineUIContainer to the Image.
Add the Run or InlineUIContainer the Paragraph via Paragraph.Blocks.Add(Inline).
Certain icons may be included in the Segoe UI Symbol Font Family. If this is the case, you may choose to not use an Image for that symbol, and instead use a Run with the FontFamily set to Segoe UI Symbol. You can play around with the FontSize if you want them to be more prominent.
Hope this helps and happy coding!

Set persistent custom colors in Windows color picker

Is there a way to have a custom color that has been set in the Windows color picker to be persistent? When I use Adobe LiveCycle and want to change a color to a color that I use all the time, I have to create it every time, and I figured since it's accessing the default Windows color picker, there might be a way to add the color and make it persistent.
IMHO, there is no way of doing so. Microsoft allows to redefine the default colors and it also allows for a hook to remember the user selected colors, but it has to happen in the source of the program. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms646375%28v=vs.85%29.aspx#custom_template on how to set default colors when compiling a program.
Even the Microsoft default Paint program is dumb enough to forget any user defined colors.
Cheers,
p.s. For others, who are programming their own application and what to allow for saving user-defined colors: http://vbcity.com/forums/t/112635.aspx

Resources