P.S. I replaced the default font with a vented version and recompiled fairly easily under Linux, but I wasn't able to get compiling under windows to work--I can use the Linux version OK, but others want to stick to windows. I'm hoping that other users may prefer a vented font also.
you don't nee to recompile the tool. You can actually install fonts by packing them into a normal layout file and putting that to some particular place. You'll have to observe some rules (i.e. layer numbers) and you can add some meta information to enhance the font information.
For more information see http://www.klayout.de/doc/about/basic_lib.html#h2-44. "Klayout's path" is the search path where KLayout looks for it's data. On Linux this will be "~/.klayout", so you'll have to put your font to "~/.klayout/fonts". You can also install a font globally if you put the file to folder called "font" into the installation path - that is where klayout's executable is stored.
(Sorry, I keep answering for Matthias, but I hope it's helpful rather than annoying)
First you need the font index. Place a BASIC.Text Pcell and look at its properties. There is a "Font" dropdown. First entry is 0, second is 1, etc. If yours is second then you use 1.
Now we need to use that number. Insert a PCell following the example here. But, instead of this line
Note, you don't have to specify anything that has a default. Everything but 'text' and 'layer' have defaults, so you could remove 'mag' (which defaults to 1.0, which you can tell if you query its default -- let me know if you want details about how to do that) and just have
no worries - I really appreciate your contributions! :-)
But did I really chose the font index for the parameter? I'm a bit scared now since what will happen if someone installs a third font which inserts itself between 0 and 1?
I'll have to check this ... a name would have been a better choice for the parameter value.
I'm afraid the font is really just an index ... I see some issues when a new font is added to the system. In that case, it's not guaranteed that the font will be added to the end and the indexes will shift.
So what I am going to do is to add a new parameter which carries the font name. If the font name is present, the PCell will pick the font by name. Otherwise it will pick the font by index. That is backward compatible and provides some safety against change of font index.
Place this file in the following directory: $HOME/.klayout/fonts (make the 'fonts' directory). On Windows this would be something like C:\Users\YourUserName.klayout, on MacOS it is /Users/YourUserName/.klayout (Use Finder's Go>Go To Folder... and type ~/.klayout ).
Restart Klayout.app
In your design, use the Text tool to type some text.
Select that text, then choose Edit>Selection>Convert to PCell... and edit the properties on the resulting PCell Instance. in the dropdown for "Font" you should see "Vented std_font".
I don't see how to make this "default" though - the built-in "std_font.gds" might actually be compiled somewhere, I don't see it in the Klayout.app sub-folders. If it is just a file somewhere, you could either delete it, or replace it with this one. However, anytime you upgrade "std_font.gds" will likely be replaced.
@Matthias I noticed that, when installing this vented font, KLayout had a notice saying "use a vector font" - have you seen, or have an example of a vector font that I can edit?
I think that is something different - that refers to text objects (labels), not text PCells. Vector fonts are scalable and change their size when zooming.
I see - so it doesn't help with converting to PCell (Polygons) which is what I want - thanks for clarifying.
Sorry having trouble remembering where I saw that warning - will let you know when I find it again.
Comments
Hi,
you don't nee to recompile the tool. You can actually install fonts by packing them into a normal layout file and putting that to some particular place. You'll have to observe some rules (i.e. layer numbers) and you can add some meta information to enhance the font information.
For more information see http://www.klayout.de/doc/about/basic_lib.html#h2-44. "Klayout's path" is the search path where KLayout looks for it's data. On Linux this will be "~/.klayout", so you'll have to put your font to "~/.klayout/fonts". You can also install a font globally if you put the file to folder called "font" into the installation path - that is where klayout's executable is stored.
Matthias
I got an additional question related to the font stuff.
I have drawn a new font an implemented under ~Program\Klayout\fonts\my_font.gds
This was successful and I can select within editor. I also want to use within a ruby script but how can I set the font with ruby?
Thanks for your help an much more thanks for that nice tool
Ronny
(Sorry, I keep answering for Matthias, but I hope it's helpful rather than annoying)
First you need the font index. Place a BASIC.Text Pcell and look at its properties. There is a "Font" dropdown. First entry is 0, second is 1, etc. If yours is second then you use 1.
Now we need to use that number. Insert a PCell following the example here. But, instead of this line
you'd add the font index
Note, you don't have to specify anything that has a default. Everything but 'text' and 'layer' have defaults, so you could remove 'mag' (which defaults to 1.0, which you can tell if you query its default -- let me know if you want details about how to do that) and just have
Though, I have never tried since I have no custom fonts installed on my system, it should work.
David
Hi David,
no worries - I really appreciate your contributions! :-)
But did I really chose the font index for the parameter? I'm a bit scared now since what will happen if someone installs a third font which inserts itself between 0 and 1?
I'll have to check this ... a name would have been a better choice for the parameter value.
Thanks for mentioning this.
Matthias
Hi,
I'm afraid the font is really just an index ... I see some issues when a new font is added to the system. In that case, it's not guaranteed that the font will be added to the end and the indexes will shift.
So what I am going to do is to add a new parameter which carries the font name. If the font name is present, the PCell will pick the font by name. Otherwise it will pick the font by index. That is backward compatible and provides some safety against change of font index.
Thanks for bringing this up.
Matthias
In case anyone else, like me, was hoping to find instructions on how to use a "vented" font:
Vented font usage:
I don't see how to make this "default" though - the built-in "std_font.gds" might actually be compiled somewhere, I don't see it in the Klayout.app sub-folders. If it is just a file somewhere, you could either delete it, or replace it with this one. However, anytime you upgrade "std_font.gds" will likely be replaced.
@Matthias I noticed that, when installing this vented font, KLayout had a notice saying "use a vector font" - have you seen, or have an example of a vector font that I can edit?
I think that is something different - that refers to text objects (labels), not text PCells. Vector fonts are scalable and change their size when zooming.
When does not message appear?
Matthias
I see - so it doesn't help with converting to PCell (Polygons) which is what I want - thanks for clarifying.
Sorry having trouble remembering where I saw that warning - will let you know when I find it again.