高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】new textstyles in odvectorizee
new textstyles in odvectorizeex
new textstyles in odvectorizeex
hi,
the function exgssimpledevice::textproc(...) offers for each vectorized text a textstyle (odgitextstyle). is this textstyle somehow linked to the textstyles defined in oddbtextstyletable?
and a second question to this: i understand that if a mtext is vectorized, i get one or more texts, each with its own textstyle. is there a way to find out if a textstyle has been used before, e.g. the same id?
torsten
odgitextstyle may have no corresponding oddbtextstyletablerecord. for example then mtext is vetorized font and other properties can be switched inside mtext string.
sergey slezkin
hi sergey,
thanks for you answer.
torsten
quote:
originally posted by torsten
and a second question to this: i understand that if a mtext is vectorized, i get one or more texts, each with its own textstyle. is there a way to find out if a textstyle has been used before, e.g. the same id?
mtext has method explodefragments(...). its fragments you get in exgssimpledevice::textproc(...). oddbmtextfragment structure has the field "changestyle". this field will be one of:
0 - no change
1 - change to original (text style mtext)
2 - change to other
--
best regards,
sergey zaitcev
about case "2 - change to other"
i noticed that library may cast shx-fonts to true-type fonts, doesn't it?
(see attachment - romans.shx -> romans.ttf)
have you got some rules to do that?
how can i use this font-casting algorithm to get true-type font from shx font?
hello,
i want to make the question more exact.
wich algorithm do explodefragments use to cast font form shx to ttf?
in my example explodefragments convert romans.shx to romans.ttf.
i'm using getpreferablefont("romans.shx", ...), but i haven't got the same result.
i want use the same algorithm to get truetype font.
bye
in addition to previous post.
another example
look at the file 7.dwg (see in attachment)
there are two mtext entitis.
all character have the same font - romans.shx, but mtext entities have different style and dif. font in style.
when i read this file, this entities look differ (see 7.jpg). because i can't get font from style, but explodefragment can do it :-) ! how do you do it?
symbolic code to try
odstring ttffont;
odstring filename;
odttfdescriptor ttfdescr;
odstring strtypeface = dd_t("romans");
ttfdescr.settypeface( strtypeface );
pexhostappservs->ttffilenamebydescriptor( ttfdescr, filename );
ttffont = pexhostappservs->getpreferablefont( strtypeface, kfonttypetruetype );
best regards,
and
mtext string can contain control sequences switching font, color, height etc.
your second mtext entity contents is:
{fromans|c204;123}
so it is rendered with romans irrespectively of font set in style.
sergey slezkin
hi, sergey
yes, it is.
i choose fromans.shx font for some symbols
and explodefragment return romans truetype font (.ttf)
i understand how explodefragment do casting from romans.shx font to true type romans font.
so i can't get romans(true type) from style when i read another mtext entity (style has romans.shx font).
sorry, maby i can't explain satisfactorily.
i think if issue is not related to casting between shx anf ttf fonts.
romans.shx is specified in style and romans ttf is specified in mtext contents. the text below will be rendered with verdana:
{fverdana|c204;123}
even if romans.shx is specified in style.
one more sample:
{fverdana|c204;this text has verdana font}this text uses font from style{farial|c204;and this text has arial font}
sergey slezkin
sergey, thank you for your attention. i think, i look folly.
i think i understand that.
i find out another feature of library.
to get font i use the algorithm:
// get text style from text of mtext entity
odgitextstyle gitextstyle;
::gifromdbtextstyle( mtext.textstyle(), gitextstyle );
// then
if ( gitextstyle.isttffont() )
{
...
gitextstyle.font( typeface, bold, italic, charset, pitchandfamily );
// attention! the "typeface" field will be not empty only for truetype fonts (times new roman etc.).
// but? on the outside, library can cast shx fonts to truetype font (romans.shx -> romans_.ttf).
// and in this case, the "typeface" field will be empty (shx font haven't got typeface)!
// gitextstyle.ttfdecriptor().filename() - it is font name! :-)
// am i right?
}
else
{
// txtstyle.isshxfont()
...
}
it is only small part of algorithm
i have got v.2.4.1 dwgdirect.
best regards
your code is related only to text style font.
mtext references only one text style. text style has only one font.
but the contents of mtext can be rendered with many different fonts. because special control sequences may swith the font.
sergey slezkin
it is only small part of code.
of course, for mtext i treat fonts in explodefragments(..).
are you agree with comments in the code?
a few posts above i wrote:
quote:
i think if issue is not related to casting between shx anf ttf fonts.
romans.shx is specified in style and romans ttf is specified in mtext contents.
sergey slezkin
|