高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】embedded fonts
embedded fonts
embedded fonts
hi,
can i embed a set of proprietary shx fonts (created by my organization) to make them usable by dwgdirect ?
is there a standard method to do it ?
thanks,
marco
you can put your shx font files into some folder and provide findfile() function which will look into this folder for fonts (see developer's guide. font handling).
it's also possible to have shx fonts not as separate files but in resources. in such case you have to override oddbsystemservices::createfile() function.
to use the .shx font dd needs be able to get pointer to object implementing odstreambuf interface in such manner:
code:
oddbstreambufptr pshxfontfile = psystemservices->
createfile(phostappservices->
findfile("txt", pdb, kfontfile));
if your overrides for findfile() and createfile() provide code above working it does not matter where and how you store the font data.
sergey slezkin
quote:
originally posted by sergey slezkin
...
it's also possible to have shx fonts not as separate files but in resources. in such case you have to override oddbsystemservices::createfile() function.
to use the .shx font dd needs be able to get pointer to object implementing odstreambuf interface in such manner:
...
i tried to override oddbsystemservices::createfile() function but it is never called when dd tries to open font file.
what is wrong ?
thanks, marco
and what about findfile()?
first findfile() is called with argument like "txt.shx"
if it's default implementation fails to find file (returns empty string) createfile() is not called.
if findfile() returns non-empty string, createfile() will be called with this string as argument.
example:
your findfile() is called with "txt.shx" argument.
it returns "my_txt.shx" string
next your createfile("my_txt.shx") will be called.
sergey slezkin
i overrided both findfile() and createfile() but createfile() is called only during dwg open file phase, also when findfile() returns a non empty string.
probably i'm doing something wrong, but i don't understand what.
marco
sorry for my english.. so if your findfile() returns non-empty string createfile() is called?
if findfile() returns empty string createfile() is not called - default built-in font is used.
sergey slezkin
probably i solved the problem.
i'm using exsystemservices code, provided by current dd library.
i discovered that dd calls accessfile() before createfile(), and, only if accessfile() returns true, createfile() is called.
i modified accessfile() and now, i can correcty load shx fonts stored into resources data.
marco
|