If i try to write text with CRhinoViewport::DrawString Method (wchar_t*, int, ON_3dPoint&, int, int, int, wchar_t*)
i do not know how to change the font. The parameter fontface does not work. It always uses something like Arial.
And if i try to use CRhinoViewport::DrawString Method (ON_Plane&, ON_2dPoint, ON_2dVector, CRhinoText&)
i cannot change the text height because CRhinoText does not have any method to change the size.
Also if i try to change the font on CRhinoText it always uses something like Arial.
Is there an example to draw text within a conduit where also the font and the font size can be changed?
vp.DrawString(str, str.Length(), screenpoint, false, 0, 24, L"Times New Roman");
vp.DrawString(str, str.Length(), screenpoint, false, 0, 24, L"Times New Roman Bold");
I don’t understand the “Italian” part…
Drawing strings using a CRhinoText object is a little more cumbersome because this object is really just a helper class for one of the many annotation objects (e.g. CRhinoAnnotationObject, CRhinoAnnotationText, etc.). These objects get their font from the document’s font table.
My tests were done in a CRhinoGetPoint::DynamicDraw overide, which draws in the SC_DRAWOVERLAY channel. But I’ve modified the SampleViewportDecorations sample, which does draw in the SC_DRAWFOREGROUND channel, and it seems to work just fine.
// Draw text
dp.DrawString(str, str.Length(), RGB(0,0,0), point);
point.y -= 20.0;
dp.DrawString(str, str.Length(), RGB(0,0,0), point, false, 0, 12, L"Arial Bold");
For clarification: it works as designed in Rhino. The Problem was, that on a german operating system i must enter the face language dependent, so instead of “Arial Bold” i have to enter “Arial Fett”. Stupid microsoft!