Here is a tricky one…
I have the font face name as an attribute on my mesh, and I want to use it on the font SOP to return the actual font to use. However, it looks like font names are only part of the drop down menu display names. When choosing a font from the menu, Houdini maps the string to the actual filename. Any ideas on how to get that filename given the font face name? I can do string operations to even match the name from the drop down menu if needed
TX!
getting font file (.ttf) based on font name?
3284 6 1- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- tmdag
- Member
- 168 posts
- Joined:
- Offline
you could use hscript with string operations like
strreplace()
substr()
etc
for eg. `strreplace(chs(“../font1/file”), “.ttf”, “”)`
or python string operations:
http://docs.python.org/library/string.html [docs.python.org]
strreplace()
substr()
etc
for eg. `strreplace(chs(“../font1/file”), “.ttf”, “”)`
or python string operations:
http://docs.python.org/library/string.html [docs.python.org]
Albert
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Hi tmdag! Thank you for your reply, unfortunately it is not that simple. Most TTF file names do not even match the font name (i.e. Arial Bold Narrow would be named something like ARLBLDNR.TTF). Most of them are so old that follow eight dot three convention.
The menu on the right of the font field in the font sop, however, does that conversion for you (when you pick a font face from the drop down menu, Houdini automatically drops the proper file name in the field as a string). However, I am not sure if you can access those menu items via python
The menu on the right of the font field in the font sop, however, does that conversion for you (when you pick a font face from the drop down menu, Houdini automatically drops the proper file name in the field as a string). However, I am not sure if you can access those menu items via python
-G
- edward
- Member
- 7766 posts
- Joined: July 2005
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- edward
- Member
- 7766 posts
- Joined: July 2005
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
-
- Quick Links