Vega Lite font availability - vega-lite

I was wondering if there is a list of supported fonts used by Vega Lite? I didn't manage to find in the docs but maybe missed in.
Specifically I am trying to use museo sans 300, which works fine in my D3.js code, but doesn't seem to be recognised in Vega Lite.
Is there a way to link to custom font files?

The way I get custom fonts for Vega Lite charts in my website is simply via CSS!
First: Define a font in your CSS
#font-face {
font-family: MyFont;
src: url(fonts/somefont.ttf);
}
Second: Refer to the font name in your Vega Lite configs
axis : {
titleFont: "MyFont"
}
Hope this helps, this is not directly related to your goal from question but still gives you ability to do custom fonts inside the chart.

Related

iText: how to include font awesome icones in generated PDF

I'm using version 2.1.7 of iText and I want to generate a PDF version of an HTML.
My HTML file contains font awesome icons:
<i class="fa fa-check" style="color:green" aria-hidden="true"></i>
When I now generate a PDF file from this HTML, nothing is displayed...
I think I'll need to register the font awesome with the font provider, but until now, I didn't found out how :(
This is my code to generate the pdf:
// pdf conversion
ConverterProperties props = new ConverterProperties();
FontProvider dfp = new DefaultFontProvider(true, true, false);
/* Temporary fix for display issue with blocks (in current html2pdf version (2.0.1) */
props.setTagWorkerFactory(new LabelBlockTagWorkerFactory());
props.setCssApplierFactory(new LabelBlockCssApplierFactory());
props.setFontProvider(dfp);
HtmlConverter.convertToDocument(html, pdfDoc, props);
footerHandler.writeTotal(pdfDoc);
pdfDoc.close();
Anyone has an idea?
Font awesome icons are injected by javascript and css into the pseudo before area. The only way you can process that if you are doing pure html is to use the font awesome cheat sheet, get the character code, use a span with that font family. You would need to download a TTF fontawesome font and register it in iText.
Although this is not iText and uses other PDF formatting, you can look here to see pseudo elements:
http://www.cloudformatter.com/CSS2Pdf.Demos.PseudoElem
Here for Fontawesome and Gylphicons:
http://www.cloudformatter.com/CSS2Pdf.Demos.GlyphIcons
And you can download the Javascript to see what happens however the whole part that does what I state above has been removed because you can get the pseudo elements from the DOM of the browser now. Before, the code would do as i said and just inject a <span> in the content with the right font-family.
You would need to abandon the use of fontawesome and just use the actual characters in the HTML as nothing processing the HTML+CSS is also going to process the Javascript that injects the icon, no more than it would replace <div id="mychart"/> with the actual chart, unless you use a solution that will execute the Javascript before you print.

Wrong HTML response - ckeditor

From admin side, I was getting rich text output from ckeditor tool.
Refer following image for this purpose.
In this if I use Comic Sans MS font then at response its giving me response like this, please see following image:
In response, I was getting Comic Sans MS, Cursive but this font I have not used at input time.
So what to do in this situation?
Really thanks to Hackerman for his help to reach at conclusion.
Basically this is not an error from ckeditor side. They are giving multiple fonts in response so whichever available via system that get used.
See following image for this purpose:
They have returned font Comic Sans MS and Cursive too. So its based on availability of font with running environment system.
In my iOS project I have added font files for Comic Sans MS font then its get directly loaded as like its showing in rich text input box.

Embedded fonts with hiqpdf

I'm trying to generate a pdf from html by using Hiqpdf. As they say in the website: http://www.hiqpdf.com/documentation/html/037cb13e-febe-4d08-a90c-a08bbd5a4348.htm this dll supports fonts embedding. However, I'm using the following fonts stored in my computer and it doesn't work.
#font-face {
font-style:normal;
font-weight:normal;
font-family:f2generic;
src:url('C:/Users/myuser/AppData/Local/Temp/f2generic.otf') format("opentype");}
I don't know is it is something wrong with the path (as it must be absolute path or the format of the font). In html format i can display the fonts right.
I checked property htmlToPdfConverter.Document.FontEmbedding and it is true, so I don't know why it doesn't work.
Thanks in advance.
You should try to use fully qualified URLs for resources like file:///C:/Users/myuser/AppData/Local/Temp/f2generic.otf

Using Font Faces - Your own font

I'm trying to add my own font to my website I have checked out quite a few stackoverflow articles many seem to be browser specific or path issues. I cant seem to get my font to display on any browser, anyone know what's up?
#font-face {
font-family: "Helvetica";
src: url('http://spawnasite.co.uk/Helvetica-Condensed-Light-Light.ttf') format("truetype");
}
h1{
text-align: center;
text-transform:uppercase;
color:#232323;
font-size: 24px;
font-family: "Helvetica", sans-serif;
}
Js Fiddle here http://jsfiddle.net/Gz26Q/
My guess here is that the font you're referencing is protected.
Not all font foundries, especially one like Helvetica, allow their fonts to be embedded. They have code within the font to prevent this.
You could still use the font on your computer, but not embed it within another application or document that doesn't have the font installed.
As a reminder from what has been mentioned before:
Change the name of your custom font-family from "Helvetica" to something else in order to avoid overriding default naming conventions.
Use multiple types of fonts for backups.
Additionally,
I highly recommend looking at FontSquirrel -- some fonts even have their own webfont kit pre-made for you to use out of the box.
If you try to load fonts in Chrome and want better rendering -- be sure to put the SVG on the top of the declaration. See here for more information.
You are trying to override an existing font, call it myHelvetica
Use others formats: eot, wot.
See these links:
http://blog.themeforest.net/tutorials/how-to-achieve-cross-browser-font-face-support/
http://caniuse.com/ttf
The basic problem is very simple: the URL of the font resource is wrong. An attempt to fetch http://spawnasite.co.uk/Helvetica-Condensed-Light-Light.ttf results in 404 Not Found.

Alternate Gothic No. 2 not embedding properly

I'm writing a Pure AS3 app, embedding a font using the Embed metatag like so:
[Embed(source="assets/fonts.swf", fontName="AlternateGothic No2")]
public static const ALTERNATE_GOTHIC_2:Class;
This has always worked for me, but Alternate Gothic No. 2 gives me issues. In Flash, the font is labeled as AlternateGothic and the style is No2. I typically combine these with a space in between as the fontName, but it's not working.
The font is Postscript Type 1, so I can't embed the file and fontFamily, unless I spend $100+ on a font converter.
I also tried creating a font symbol, but that didn't work either. Any ideas?
FontExplorerX has the font labeled as AlternateGothic-No2, so I tried that and it worked.