Matlab Plot - Font Zapf Dingbats Will Not Render - macos

I have a Matlab program where I need to include a plane icon (Zapf Dingbats 40) in the plot. Everytime I run it, it falls back to a system font.
Is there anything that I am doing wrong? This is not the exact code, but illustrates the problem:
title(char(40),'fontname','ZapfDingbats','fontsize',50);
The resulting plot always displays ( instead of the Dingbats plane icon ✈.
I verified that the font is installed and I can type with it on Word.
I am using Matlab R2013b on Mac OSX 10.9.1.
EDIT: It prints correctly to a pdf, but does not display correctly.

You may use the 'Wingdings' font for that. The following code
text(0.5, 0.5, char(81), 'fontname', 'Wingdings', 'fontsize',50);
gives
The 'ZapfDingbats' font may not be in the /Library/Font folder (but 'Wingdings' is), even if listfonts tells you that the font is there. Actually, the listfonts
function adds some extra fonts to the list of the available fonts, and I don't get the rational of that.
% always add postscipt fonts to the system fonts list.
systemfonts = [fonts;
{
'AvantGarde';
'Bookman';
'Courier';
'Helvetica';
'Helvetica-Narrow';
'NewCenturySchoolBook';
'Palatino';
'Symbol';
'Times';
'ZapfChancery';
'ZapfDingbats';
}];

Related

Why does rotating a Code 128 bar code with ZPL make the barcode thicker?

Consider the below ZPL code.
^XA
^BY2,2,80
^FO50,50^BCR^FD3079+Plate-SS-14 # 44^FS
^XZ
Using the online viewer at http://labelary.com/viewer.html shows you vertically rotated bar code with label beneath and everything appears to be fine.
However, when I print the label the bar code is not scan-able because the lines of the bar code are too thick (see below images). Removing the rotate flag from ^BCR and making it ^BC fixes the issue and the lines are perfectly normal and scan-able. I have tried numerous different methods to rotate the code with no success and can't wrap my head around as to why the lines become thicker when rotating a bar code.
Does anyone have any insight as to why this happens?
Broken Rotated Barcode Image
Working (not rotated) Barcode Image
In my case, the solution was the printing speed being too fast. Another potential solution would be to turn down the darkness or temperature of the printer itself if it's an option in the settings.
Simply opening my respective zebra printer's printing preferences showed me a Print Speed setting which was set to 12.7 cm/s. Reducing it down to 10.1 cm/s fixed the problem.
Adjust the Darkness of the printing and/or the speed of the printing. that should solve your problem.
I think it is a problem with your use of the PNG file that the site generates. The PNG file generated includes enough whitespace in the front (top) quiet zone of the symbol to scan, but if you use the Windows system viewer to print the barcode and print in full size, it slices off the top-most bars.
Try embedding the PNG file into a document, setting the photo size to less than full page, or use the PDF file.

Icons in setting menu may have unexpected vertical lines

We are running cobalt with openGL enabled, and the graphics appear to display correctly under 1920x1080 resolution.
But once in a while, some icons in the "Settings" menu may have unexpected vertical lines on top (as shown in the picture).
We are guessing the icons are created from TTF font file, but we are not sure how it is rendering onto the screen.
We want to dump the icons to file at the following points to check what went wrong.
When the icon is actually converted to image.
When the icon experience further modification. (eg, color change, bolding, etc)
When the icons are rendered onto screen canvas.
Would really appreciate if someone can help to point out where in source code these events may be happening.
I guess the first question is: are you running the stable branch or the experimental branch of Cobalt?
Beyond that, yes, the icons are created from a TTF font file that is downloaded remotely. The icon itself is simply a character that is converted into a glyph, like the text above it, albeit at a much larger size.
I believe that the logic that you're looking for is within RenderText() in cobalt/renderer/rasterizer/skia/render_tree_node_visitor.cc. SkCanvas::drawTextBlob() is passed the glyph and color information that it uses to render the icon.
The specific glyph that is being used looks correct, but the location where the render_tree::GlyphBuffer representing it is created is TextShaper::CreateGlyphBuffer() in cobalt/renderer/rasterizer/skia/text_shaper.cc.

How to use different styles of local fonts in plots with Gadfly in Julia-lang on Mac?

I want to create plots with Gadfly in Julia programming language using a specific font style (e.g., Avenir Next Bold) of a local font (Avenir Next) on my Mac. It works for the standard font style in the case of an standard histogram example:
using Gadfly
plot(x=randn(2000), Geom.histogram(bincount=100),
Theme(minor_label_font="Avenir Next",
major_label_font="Avenir Next",
key_label_font="Avenir Next"))
Yet when a specific font style such as "Avenir Next Bold" is used the default font is applied instead of the provided one. The Avenir Next fonts are saved as a "container" in a ttc format. I tried to convert the ttc file into single ttf files for the font styles and to call the exact paths where the files are located. Both don't work.
I think this is a case of getting the font name exactly right.
(I used HeavyItalic because it's easier to tell if the correct font is chosen.)
It might be that you have to use the PostScript font name, although I'm not sure why that would be, unless deep down in Cairo that's how fonts are accessed... ?
You can get the PostScript names (if that's what they are) by looking at a font manager. For example, FontBook shows them on the info panel:

Offset when convert SVG to font with Glyphter.com - Offset

I created a simple SVG in Adobe Illustrator and then I save it as a SVG:
I then upload this SVG to glyphter.com and it looks perfectly centered:
I then drop the .svg file generated by the Glyphter download into fontello and I use it in my website but all the ones I generate are offset like this:
Does anyone know why the offset is there? Shouldn't it be cenetered?
I even tried making my SVG graphic save with artboards and i used artboards of height and width the same so its a square.
As mentioned in the comments, you can use FontForge for low-level control of the glyphs in almost any font.
FontForge is free: https://fontforge.github.io/en-US/
It can be installed on Windows, Mac OS X and GNU+Linux
You can manipulate individual glyphs, and perform bulk operations
When you're done editing your font, you can export it to almost any font-mime-type (ttf, otf, woff, svg, etc)
This is a good manual for installing and using FontForge:
http://designwithfontforge.com/en-US/index.html
The information you will probably need for this specific issue is here:
http://designwithfontforge.com/en-US/Spacing_Metrics_and_Kerning.html
Bulk centering all glyphs:
open the font you want to edit
to see all the relevant glyphs select Encoding -> Compact from the top menu
to select all the glyphs, press Ctrl+A on your keyboard, then
to center all the glyphs relatively, select Metrics -> Center in Width from the top-menu.
The following screen-shots illustrate the last 3 points in sequence - mentioned above:
When you're done, select File -> Generate Fonts from the top-menu and choose the font-type you want, choose the target folder, and hit Save.

Matlab GUI Compatibility Between Mac and Windows (Display)

For some time now, I've been working on a series of GUIs. I use a Mac running OSX to write all of my code, and the problem I've encountered is that it there are deviations in appearance when the GUIs are used in windows, some of which are minor, and some of which are very significant.
1) The text in the windows version is substantially larger overall. This results in some of my button titles simply going off the button, or panel titles moving beyond the panel.
2) Axes appear to be different dimensions between Mac and Windows. i.e. An axis that appears square on my Mac will appear elongated or rectangular on windows, and vice versa.
3) Graphical displays are different. This is the real problem. Some of my GUIs use axes to display text and model chemical reaction animations. On the Mac, they look perfectly fine, but on the windows system, the sizing is completely off.
I've set all "Units" to "characters" as suggested by the Mathworks help page, and I do not specify any fonts to allow each system to use its default. I have however, specified font sizes, but apparently, 12 point font on windows appears very different from 12 point font on mac.
Are there any ways around these problems? I thought setting a specified font size and allowing for use of default fonts would fix this, but it hasn't, and I'm a little dry for ideas at this point.
Try working in 'pixels' or absolute size units instead of 'characters', and apply a scaling factor to your font sizes.
Setting 'Units' to 'characters' is probably the wrong way to go for portability, and could be the main cause of your display sizing issues. Which specific Matlab page recommended that you do so? Was it talking about cross-platform portability? The characters unit is very convenient to work with, but it is tied to the font metrics for the default system font. (See the doco for Units property at http://www.mathworks.com/help/matlab/ref/axes_props.html). That's going to differ between different operating systems. Working with 'pixels' or inches/centimeters/points, which are absolute, will probably give you more uniform results across operating systems.
And you're not wrong: OS X tends to display fonts of a given size on screen smaller than Windows does. (Generally; YMMV depending on your display DPI and system settings and other things.) For example, I run my terminals and text editors at 10 or 12 points in Windows, but 14 point or larger on Mac. So apply a scaling factor to the font sizes you set in your GUI. Figure out what looks good on Mac, and then scale it in your code to something like windows_font_size = floor(mac_font_size * 0.8) and see how it goes.
If you want to be more precise in scaling, you could grab the ScreenPixelsPerInch and ScreenSize root properties with get(0,...). You may also be able to call down in to Java code to get precise font metrics info to help with font scaling choices.
Either way, you're going to have to test your code on both systems instead of just expecting it to work portably. If you don't have ready access to a Windows development system, consider setting up a Windows VM on your Mac. With file sharing between the two sides, you'll be able to try your code out on both platforms right as you work with it.
I encountered this problem as well.
Calling this function within the FUNCTIONNAME_OpeningFcn might alleviate your issues:
function decreaseFontSizesIfReq(handles)
% make all fonts smaller on a non-mac-osx computer
persistent fontSizeDecreased
fontSizeDecreased = [];
if ~ismac()
% No MAC OSX detected; decrease font sizes
if isempty(fontSizeDecreased)
for afield = fieldnames(handles)'
afield = afield{1}; %#ok<FXSET>
try %#ok<TRYNC>
set(handles.(afield),'FontSize',get(handles.(afield),'FontSize')*0.75); % decrease font size
end
end
fontSizeDecreased=1; % do not perform this step again.
end
end

Resources