Step by Step guide on how to convert photo's into COLR fonts.

Before asking a question on FontCreator look here for possible solutions and tutorials. Please do not post support requests here.
Post Reply
ShawnDion
Posts: 34
Joined: Sun Aug 24, 2014 1:08 pm

Step by Step guide on how to convert photo's into COLR fonts.

Post by ShawnDion »

Complete ​ Step by Step guide on how to convert photo's into COLR font characters.


Here's a walk through on how to make photo's into COLR font's this is the basics in the following weeks I will show you how to reduce the glyph size and improve on the quality of the work that is done. This is just the bare bones on what you need to make your life easier. My goal is to help you increase on the level of creativity and to see if certain tricks are useful enough to be suggestions of implementation for FontCreator.


Before we begin you will require to get the following software's installed on
your computer and certain settings to be configured for everything to work accordingly.


List of Software's Required: [center]You should already have High-Logic Font Creator 14 already installed if not download the application and install the trial version as you can test this out like everyone else.
[/center]
Download all required tools once done you will have the following list of files.

- FontCreatorSetup-x64.exe
- inkscape-0.92.5-x64.exe
- eggbot2.7.1_win.zip
- inx-pathops-v0.4.zip
- xmlstarlet-1.6.1-win32.zip


Installing Inkscape

Image
Click [OK]

Image
Click [Next]

Image
Click [Next] to accept the license agreement.

Image
Select the type of install: to Full then Click [Next]

Image
Click [Install]

Image
Wait for the installation to complete.

Image
Uncheck [Run Inkscape] then Click Finished.

Image
Unzip Eggbot extension pack (eggbot2.7.1_win.zip) take the 2 folders insideUnzip Eggbot extension pack (eggbot2.7.1_win.zip) take the 2 folders inside

Image
and copy them into the folder C:\Program Files\Inkscape\share\
Close the folder when you are done.

Image
Unzip inx-pathops-v0.4.zip and copy the contents of folder src

Image
into C:\Program Files\Inkscape\share\Extensions

STEP BY STEP
How to create our Glyph pack and color list that we require for High-Logic FontCreator 14
Create a folder on your Desktop called Workplace as we will store all our work files into this location for consistency.

First we need an image, for this example, I'm using the Photo of Erwin Denissen CEO of High-Logic.
The original size was 1968x2188 @98400 colors for this to be workable we need to reduce the size to something more manageable.
I reduced the image height to 300 pixels of the size using simply just Microsoft Paint however for better results you can also use your preferred image editor.

Image

Image

Image

Image

Our next step is to launch Inkscape.
-=-
Image
Click File → Open

Image
Open the folder Workplace choose the size 300 image. Click [Open]

Image
Click [OK] (No changes required)

Image
Click once on your image to select it or use [CTRL+A]

Image
Click on the Tab [Path] -> Trace Bitmap...

Image
Set this screen the same as above and Click [OK]
(Once the trace is completed the [OK] button will un-grey itself you may now close this with the [X] in the right corner)

Image
Click on Extensions -> EggBot Contributed -> Post process trace bitmap...

Image
Click [Apply]

Image
Click [OK]

Image
Wait until this window closes.

Image
To make sure everything worked correctly Click on the Tab [Layer -> Layers...]

Image
If you see on the right side digits with color codes the process was done correctly

Image
Click Tab [File -> Save As...]

Image
Make sure your in the folder Workspace then click [Save]

Now we will need to create a batch file with the following contents and place it inside the folder Workspace.
-------------------------------------------------
SVGSplit.bat
-------------------------------------------------

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion

Powershell -command Get-Content "'%1'" -head 52 >"Header-%~n1.txt"

for /f %%i in ('XML.EXE sel -t -v "count(//_:g)" "%~1"') do set var=%%i

for /L %%n in (1,1,%var%) do xml sel -t -m "//_:g[%%n]" -c . "%~1" >%%n.sv_

FOR %%s IN (*.sv_)  do copy "Header-%~n1.txt"+%%s %%~ns.sv1

ren "*.svg" "*.bak"

for %%f in (*.sv1) do (
echo | set /p="</svg>" >>%%f
for /f "delims=" %%j in ('xml sel -t -v "//@inkscape:label" "%%f"') do (
rename "%%f" "%%j.svg"
))
del *.sv1
del *.sv_
for %%f in (*.svg) do (
    set FileName=%%~nf
    set FileName=0000000000000000!FileName!
    set FileName=!FileName:~-13!%%~xf
rename "%%f" "!FileName!"
) 

for %%f in (*.svg) do (
echo Glyph_%%~nf >>Glyph.txt
)
We will also need the xml.exe file from the package "xmlstarlet"

Image

Image

Drag your svg file onto the created batch file called SVGSplit.bat

Image

Once you run this batch file you will end up with a file that contains the list of the Glyph with the color id and seperate svg files for importing into High-Logic Font Creator.

Start High-Logic Font Creator
Image

Click on File -> New.

Image

Give the font a name I went with “Erwin Denissen Font” and for this demo I decided to select “Don’t include outlines” Then Click Ok.

Image

Find E as we will be assigning the glyph images to that character.
Image

Make sure your Glyph display mode is Color COLR.

Image

Image

Under tools options exchange we need to make sure this is unchecked (Move imported outlines to origin) else wise the mass import of our SVG’s will not work.Under tools options exchange we need to make sure this is unchecked (Move imported outlines to origin) else wise the mass import of our SVG’s will not work. (I suggest using the same settings as the screenshot)



ImageImage

Open the text file Glyph.txt with Notepad that we created inside the Workspace folder Copy it’s content (Ctrl-A, Ctrl-C)


Image

Image
Now in High-Logic Font Creator go to insert Glyph choose the by name tab paste the glyph list (CTRL-V). Click ok.

Image

Image

Image





Now go to the Workspace folder where we created the separate SVG's
Click the first 001 svg hold shift scroll down click the last numeric svg code then go up the list highlight the first one then drag the files to the box besides the E that we created it should say Glyph_001 wait a few moments. Right click on Glyph_001 and choose Color-decolorize the glyphs will appear.
OK now we’re at the stage of needing to color the glyphs.
Image

Image



You need the following windows opened: glyph Properties / Palette and the font itself opened to do this.Highlight Glyph_001 Copy the color name for example here Glyph_001 - #f6f4eb under Glyph properties just copy the #f6f4eb by double clicking and using Ctrl-C under palette press the + sign besides the word foreground then paste the color info into hex color press apply.
-=-
After that done right click on Glyph_001 and choose Color – Colorize to selected color.
Go to Glyph_002 and repeat the process until all your Glyph s are done.
(Yes this is a long process however I'll explain at the end n how to use Pullover's Macro Recorder with example script you can modify for your need.)

Image


When you’ve completed all the Glyphs Double click on the E glyph
Image

Turn on Colr mode if it's not on via View Color Mode Color COLR
Image

Image

Right click on the window where the E glyph is click Add select all the Glyph_001 to Glyph_256 click OK. Once you exit the E glyph it will have a small picture.


Image

You can now open Preview (View-Panels-Preview) to see the result.


Alternative method for the Color Steps:
I use Pullovers macro if you look at Figure O to do the steps of coping the color adding it and setting it onto the glyph by machine it takes 15 minutes so by hand if your fast maybe 30 minutes to do. I will make a more detailed guide and tutorial for that too. (Figure R)

Code: Select all

[PMC Globals]|None||
[PMC Code v5.4.0]|F3||252|Window,2,Fast,0,1,Input,-1,-1,1|1|Macro1
Context=None|
Groups=Start:1
1|[Pause]||1|2000|Sleep|||||1|
2|Left Move & Click|624, 660 Left, 1|1|10|Click|||||2|
3|Left Move & Click|875, 235 Left, 2|1|10|Click|||||4|
4|[Text]|^c|1|0|Send|||||6|
5|Left Move & Click|142, 273 Left, 1|1|10|Click|||||7|
6|Left Move & Click|289, 449 Left, 2|1|10|Click|||||9|
7|[Text]|^v|1|0|Send|||||11|
8|Left Move & Click|385, 447 Left, 1|1|10|Click|||||12|
9|Right Move & Click|618, 655 Right, 1|1|10|Click|||||14|
10|[Text]|{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Up down}{Up up}{Right down}{Right up}{Enter down}{Enter up}|1|0|Send|||||16|
11|[Pause]||1|1000|Sleep|||||17|
12|[Text]|{Down down}{Down up}|1|0|Send|||||18|
This is what the Fontcreator.pmc file looks like needs adjustments depending on screen layout here's a example of my setup.

Image

Line 2 the glyph location, 3 is the glyph properties color (it selects it), 4 copies it, 5 clicks the + sign besides foreground , 6 selects the hex color, 7 replaces it 8, clicks apply 9 opens the popup menu on the glyph 10 goes up to select to apply the color 12 goes to the next glyph.

Image

Inside the pullover macro application you setup the co-ordinates for your screen I suggest setting up like my format and using the arrow keys on the glyph to align the first one to the bottom. On the top right you see a counter that number is the same as the number of glyphs you have this way the system will add the colors to all the imported svg's instead of doing it manually.

Just wanted to give you all the basics of how it was done (After 8 years) I’ll keep refining this document should you have and questions or suggestion let me know.

Thanks for reaching the end of this tutorial and special thanks to the FontCreator Team in making leaps and bounds since version 7.5 none of this would be possible to do in automatic without the improved changes.

The next tutorial in progress will show you how to remove overlapping using inx-pathops to improve on size and speed of font loading and the pleasures of making your own sprites.

Shawn
Attached is the layout file you can use to match mine for the color script.
_________________________
Attachments
layout.xml
(2 KiB) Downloaded 529 times
בן של מלך
Posts: 58
Joined: Wed May 25, 2022 4:29 pm
Location: Hadera, Israel

Re: Step by Step guide on how to convert photo's into COLR fonts.

Post by בן של מלך »

I went through all the steps, all worked except one....
I did not get along with the code of the bat file.
It won't export svg files, and in the txt file that came out I got this inscription:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:cc="http://creativecommons.org/ns#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    width="210mm"
    height="297mm"
    viewBox="0 0 210 297"
    version="1.1"
    id="svg4082"
    inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
    sodipodi:docname="drawing.svg">
   <defs
      id="defs4076" />
   <sodipodi:namedview
      id="base"
      pagecolor="#ffffff"
      bordercolor="#666666"
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="0.35"
      inkscape:cx="815.64105"
      inkscape:cy="886.17698"
      inkscape:document-units="mm"
      inkscape:current-layer="g4133"
      showgrid="false"
      inkscape:window-width="1920"
      inkscape:window-height="991"
      inkscape:window-x="-9"
      inkscape:window-y="-9"
      inkscape:window-maximized="1" />
   <metadata
      id="metadata4079">
     <rdf:RDF>
       <cc:Work
          rdf:about="">
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
         <dc:title></dc:title>
       </cc:Work>
     </rdf:RDF>
   </metadata>
   <g
      id="g4115"
ShawnDion
Posts: 34
Joined: Sun Aug 24, 2014 1:08 pm

Re: Step by Step guide on how to convert photo's into COLR fonts.

Post by ShawnDion »

Sorry about the delay in regards to your post my PC was in the shop fried video card.

Getting back to the issue on hand I am currently re-writing the tutorial as the inkscape version new format has changed and makes the resulting code fail. Works fine with svg's that are created with
0.92 2017.
0.91 2015.
0.48 2010.
0.47 2009

As for 1.0 they completely changed the format so the batch with the appropriate commands no longer work correctly however no worries I''ll have a new version adapted to 1.0 and up ready this week including way faster methods in doing these steps including code that I was able to generate with chatpgpt to do differences on svg layers to reduce the load of the actual font. The latest I'll have this posted is by the 1st of October.

ShawnDion
בן של מלך
Posts: 58
Joined: Wed May 25, 2022 4:29 pm
Location: Hadera, Israel

Re: Step by Step guide on how to convert photo's into COLR fonts.

Post by בן של מלך »

ShawnDion wrote: Sun Sep 24, 2023 7:19 pm As for 1.0 they completely changed the format so the batch with the appropriate commands no longer work correctly however no worries I''ll have a new version adapted to 1.0 and up ready this week including way faster methods in doing these steps including code that I was able to generate with chatpgpt to do differences on svg layers to reduce the load of the actual font. The latest I'll have this posted is by the 1st of October.

ShawnDion
October 1st was 8 days ago.
There is an update?
Post Reply