Qt font OS X and FontBook - macos

I noticed this problem using Qt libraries, but, to be honest, than I found that is a global OS X issue. I have a music font, say the classic Petrucci.ttf or Marl.ttf... As I put characters using QPainter::drawText() function, I can see only standard letters.
Also this happens using asian fonts or other symbolic fonts. The same Qt code compiled on Windows can render the fonts in a correct way. So, for instance, the letter "a" is a note or a pause, or a clef...
In Mac, letter "a" remains an "a".
The strange thing is that if I open the font in the Font Book, the font is rendered correctly. So I also tried to use it on OpenOffice, Pages or TextEdit. Always on Mac symbolic fonts are rendered normally, typed letters remain letters.
Do you have any suggestions??
Thanks...

OK, one answer I found is to check the entire font map and grab the unicode value of the range of interest. For example, for the font I'm using is 0xf021-0xf0fb, so, you can draw a non text symbol like this:
char c = 0xf021;
QString str = QString( QChar( c ) );
painter.drawText( 10, 10, str );

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.

install Hebrew Font matlab

I am looking for a way to install hebrew fonts in my matlab (R2009b,windows 7). I am not looking for solution to display or read hebrew charecters, but a way to be able to work with hebrew like in english letters (for strings purpusese). the problem that got me here is that I have sound files that their name is in hebrew and I need to read them from matlab. but when I am trying to read the list of files (using ls) I get question marks where the hebrew letters were.
The command listfonts will list all available system fonts. If no Hebrew font appears in the list, then you'll have to install one at the OS level, such as AdobeHebrew (alternatively, Google "free hebrew fonts").
It's possible that the font you're using in Matlab simply doesn't have the Hebrew font glyphs ("characters"). So the missing characters are substituted with '?'. You can "link" a font to another in the GDI by editing the Registry at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink.
For example: Let's assume your copy of Matlab is using the font Consolas, and you want it to use the font Miriam for glyphs that don't exist in Consolas. To get that to happen, you need to add a String value to the Registry key above. The name of the string must be Consolas and it should have a value of mriamc.ttf. That tells the Windows GDI to render missing glyphs in the font named "Consolas" using the font in the file "mriamc.ttf".

How to display math in LaTeX font using Visual Studio 2010 C#

I would like to display mathematical symbols in the conventional LaTeX Font using C# in Visual Studio 2010. I do NOT want to use the LaTeX equation editing machinery, I only want to use the
traditional LaTeX font family, which I believe is called Computer Modern. Using mathematical
symbols in this font, I would like to build my own equation editor.
I have already downloaded and installed the Computer Modern font, and indeed I can now select this font from the list in Visual Studio. However, as a result all the text characters are indeed displayed in the Computer Modern font, all the mathematical symbols are NOT; the latter seem to be completely unaffected by changing the Font Family property.
For example, I have a label whose content property is a text string which contains a formula,
say the integral over x of some function f(x). I would like to display the formula in the conventional LaTeX font style. I use the unicode \u222b to refer to the integral sign. So the
text string reads \u222b f(x)dx. Now, when I change the Font Family property, only the text f(x)dx is affected, but the integral sign remains exactly the same! I find the unicode integral sign
extremely ugly, and the traditional LaTeX integral sign very beautiful, as is the case for many
other mathematical symbols as well. How can I make sure that the integral sign becomes displayed in the traditional LaTeX font style?
Please use a simple language in your answer, I am not a professional!
Any help is much appreciated!
If you downloaded a Computer Modern font that Windows understands, this is likely a conversion to TTF of the original representation in TeX. TeX was invented before Unicode, so these characters are probably missing from the converted font, causing Windows to fall back onto its default font.
TeX also does custom tricks, such as composing multiple glyphs into stretchable integral signs, which are not supported by the Windows font renderer.
Furthermore, using such a custom font, your application won't work properly on computers that don't have the font.
I think your best bet, sad but true, is to use LaTeX to render the equations to PNG files (with a transparent background), and use these in your UI. This question on SuperUser should help you accomplish the creation of these PNGs.

Why flash on Mac does not display font correctly?

We have standard flex 3 project, and We have left everything as default, no change in style at all, and we deployed our project and noticed that on Mac the character spacing is very bad and overall look and feel is not as clear as that of windows.
Here is the difference, left one is Windows and right one is Mac.. the default flex font chosen by Adobe is "Verdana", the left one looks pretty, but right one looks as its width and character spacing, everything is incorrect. I assume verdana font may not be available on Mac, but in that case I supposed adobe should have given default standard font of good quality.
alt text http://akashkava.com/images/MacFlashFontProblem.png
What can we do to resolve this? Will embedding Verdana font in flex project style will help?
Mac OS X and Windows have different text rendering engines. I've heard it said that Mac OS X tries to preserve the character shape while Windows tries to align with screen pixels at small sizes.
That's going to result in differences between how fonts are rendered, and there's really no way to work around it.
Personally, I think the example on the right looks much nicer; the one on the left looks square, like it's being rendered at too small a size, while the one on the right looks more like the font is supposed to look.
It's not a solution, but Verdana is available on every OS X box. See this Apple doc for 10.5; I couldn't find one on 10.6 but there is one.

How to Programmatically Identify a PI Font (a Dingbat) under OS X

There is a class of fonts called Pi fonts whose glyphs, under OS X, get mapped to the private Unicode space 0xF021-0xF0FF such that if you subtract 0xF000 from each unicode character to retrieve the 8-bit version of the character and be able to draw that character as if it were a standard Roman character.
My question is how do I recognize these fonts? It's obvious the system can do so because there is a category on the Special Characters palette called "Pi Fonts" which apparently has the various such fonts installed on my system. In my case they are BookshelSymbolSeven, MSReferenceSpeciality, MT-Extras, Marlett, MonotypeSorts, Webdings, and various Wingdings. If I use the old fashioned QuickDraw routines to ask for the TextEncoding of these fonts, I get a value of 0x20000 which I do not see in the system header file TextCommon.h. Am I supposed to treat any font with a TextEncoding of 0x20000 as a Pi Font? And I'd rather not use any QuickDraw font handling routines for obvious reasons.
The closest thing I know is NSSymbolicTraits called NSFontSymbolicClass of NSFontDescriptor. The code
NSFontDescriptor*fontDesc=[NSFontDescriptor fontDescriptorWithFontAttributes:nil];
fontDesc=[fontDesc fontDescriptorWithSymbolicTraits:NSFontSymbolicClass];
NSArray*foo=[fontDesc matchingFontDescriptorsWithMandatoryKeys:[NSSet setWithObject:NSFontTraitsAttribute]];
NSLog(#"%#",foo);
gives me a list of Pi fonts + Braille + a bit more.

Resources