这个方法避免使用了set_display_font 和 disp_message(在Halcon中导出C++版本时这两个函数没有封装好,使用这两个函数的话需要复制大段代码)
本文仅需两行代码。
//字体 +风格+字号
//风格Bold Italic Normal
//if (0 != (hv_Font == HTuple(“Courier”)))
//{
// hv_Fonts.Clear();
// hv_Fonts[0] = “Courier”;
// hv_Fonts[1] = “Courier 10 Pitch”;
// hv_Fonts[2] = “Courier New”;
// hv_Fonts[3] = “CourierNew”;
// hv_Fonts[4] = “Liberation Mono”;
//}
//else if (0 != (hv_Font == HTuple(“mono”)))
//{
// hv_Fonts.Clear();
// hv_Fonts[0] = “Consolas”;
// hv_Fonts[1] = “Menlo”;
// hv_Fonts[2] = “Courier”;
// hv_Fonts[3] = “Courier 10 Pitch”;
// hv_Fonts[4] = “FreeMono”;
// hv_Fonts[5] = “Liberation Mono”;
//}
//else if (0 != (hv_Font == HTuple(“sans”)))
//{
// hv_Fonts.Clear();
// hv_Fonts[0] = “Luxi Sans”;
// hv_Fonts[1] = “DejaVu Sans”;
// hv_Fonts[2] = “FreeSans”;
// hv_Fonts[3] = “Arial”;
// hv_Fonts[4] = “Liberation Sans”;
//}
//else if (0 != (hv_Font == HTuple(“serif”)))
//{
// hv_Fonts.Clear();
// hv_Fonts[0] = “Times New Roman”;
// hv_Fonts[1] = “Luxi Serif”;
// hv_Fonts[2] = “DejaVu Serif”;
// hv_Fonts[3] = “FreeSerif”;
// hv_Fonts[4] = “Utopia”;
// hv_Fonts[5] = “Liberation Serif”;
//}
HTuple hv_Font = (HTuple(“Times New Roman”) + “-”) + “Normal” + “-” + “28”;
SetFont(hv_WindowID,hv_Font);