-
Notifications
You must be signed in to change notification settings - Fork 49
How to use custom images
If you need something special, that not exists in embedded collections, you can import custom images into fontello. We currently support 2 vector formats:
- SVG fonts.
- SVG images.
Usually, other vector formats can be converted to SVG.
If your font is on TTF / OTF / WOFF format, use FontForge or something like this to convert font to SVG format. In FontForge do the following:
- Open your font via
File > Open
menu. - Then, in
File > Create fonts...
menu selectSVG
format and save file. - Drag and drop SVG file to fontello page.
You should understand, that SVG format is more rich, that can be supported by fonts. Though we try to automate importing process, sometime it's more safe to prepare image in editor for exact result.
Here are our recommendations:
- Remove all fills and colors. In fonts fill is defined by contour direction. Probably you can leave black fills. Make sure, you don't have complex rules like
evenodd
fills. - Remove all FAT lines attributes. Those are not supported, anyway. In fonts, fat line is drown by 2 nested contours.
- Join all contours to single outline. That's the last and the most important step. Usually, editors automatically set right contours direction, dependent on nesting and black fill.
Troubleshooting.
If you see, that contour is missed after import, or have inversed fill:
- Check that SVG contours were joined prior to import.
- Try to reverse direction of missed contours.
You may need to do some additional simplification of your drawing, such converting objects and strokes to paths (see the Path menu), in addition to the below. You can check the svg file output in a text editor - if it has worked correctly, you should see a single <path>
element and an empty <defs>
element.
- Select all
- Object -> Ungroup
- Path -> Union
- Path -> Combine paths
- File -> Vacuum Defs
- Save as -> Plain SVG
Make sure that you have merged your vectors together into a compound path. This is done by selecting all the paths in your glyph and using "Object > Compound Path > Make". If you've already grouped them into a binary group you'll need to expand it first.
Once you have a single compound path you'll do a "File > Save As", select SVG from the drop-down, and hit save. You'll want to use the default "SVG 1.1" file format.
(Note: there are some issues with preserving the entire artboard - the "Save As" appears to trim the artboard to the shortest dimension. Haven't found an effective way to remedy this so we're working around it in CSS.)
(Note2: Illustrator seem to have some problems with the artboard size and Save As... SVG. The solution : create a new perfect square document about 500px, copy and past your artwork, save in SVG. And now, each time you open an SVG file, the artboard keep the latest artboard dimension. You could center correctly your artwork in this artboard, and save again )
One trick that may work is to include a rectangle of size 1000x1000 in the Illustrator document, locked with no fill or stroke colour. This will be exported in the SVG, enforcing a minimum size. However, as it's a rect
rather than a path
, Fontello will ignore it with a warning message, "Skipped tags and attributes: rect".
- We recommend to set height to 1000px and crop width to visible part. Though, fontello automatically rescale image from any size, we don't recommend use very small dimensions, because that can affect precision.
- Usually, image should be aligned text baseline, or text middle line. By default, fontello set baseline to 15% from bottom (you can change this). So, if you need to allign you icon by baseline - set it's bottom to 15% from paper bottom. And if you wish to align it by middle line - just center it visually on paper.
- If you wish to show image in small size, try to draw it "pixel perfect". Here is wonderful article about.