2D text (angled) with background

For 2D texts, by default, backgrounds will be screen aligned.

If you call HC_Set_Text_Path() to
angle you texts, text’s background will look like the screenshot below.

If you want to maintain background size, you should:

  • Insert Text at the origin
  • Rotate a bit around Z-axis
  • Translate text to the old insertion point

Sample Code:

void CSolidHoopsView::OnExtraSlot2()
{
HC_Open_Segment_By_Key(m_pHView->GetModelKey()); {
HC_Open_Segment("text");
HC_Set_Color("text=black, faces=yellow, edges=black");
HC_Set_Text_Font("background=shape=box, backgrounds,transforms=on, name=sans serif, size=36 points");
HC_Insert_Text_With_Encoding(0, 0, 0, "UTF8", "TEST123");
HC_Close_Segment();
} HC_Close_Segment();

HVector front, top;
front.Set(0, 0, 1);
top.Set(0, 1, 0);
m_pHView->SetViewAxis(&front, &top);
m_pHView->SetViewMode(ViewMode::HViewFront);
m_pHView->Update();

}

void CSolidHoopsView::OnExtraSlot3()
{

HC_Open_Segment_By_Key(m_pHView->GetModelKey()); {

	HC_Open_Segment("text");
	HC_Set_Color("text=black, faces=yellow, edges=black");
	HC_Rotate_Object(0, 0, 45);		    
    HC_Translate_Object(0.2f, 0.1f, 0.0f);
	HC_Close_Segment();
} HC_Close_Segment();

m_pHView->Update();

}