• halconquery_font返回可用字体


     在HDevelop中

    dev_update_off()
    read_image (Image, 'D:/bb/tu/ma.jpg')
    get_image_size (Image, Width, Height)
    dev_open_window(0,0,Width, Height,'black',WindowHandle)
    dev_display (Image)
    query_font (WindowHandle, Font)
    *返回可用字体
    *参数2:返回可用字体
    *['Arial', 'Bahnschrift', 'Calibri', 'Cambria', 'Cambria Math', 'Candara', 'Comic Sans MS', 
    *'Consolas', 'Constantia', 'Corbel', 'Courier New', 'Ebrima', 'Franklin Gothic', 'Gabriola', 
    *'Gadugi', 'Georgia', 'Impact', 'Ink Free', 'Javanese Text', 'Leelawadee UI', 'Lucida Console', 
    *'Lucida Sans Unicode', 'Malgun Gothic', 'Microsoft Himalaya', 'Microsoft JhengHei', 
    *'Microsoft JhengHei UI', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Sans Serif', 
    *'Microsoft Tai Le', '微软雅黑', 'Microsoft YaHei UI', 'Microsoft Yi Baiti', 'MingLiU-ExtB', 
    *'PMingLiU-ExtB', 'MingLiU_HKSCS-ExtB', 'Mongolian Baiti', 'MS Gothic', 'MS UI Gothic', 
    *'MS PGothic', 'MV Boli', 'Myanmar Text', 'Nirmala UI', 'Palatino Linotype', 
    *'Segoe MDL2 Assets', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Emoji', 
    *'Segoe UI Historic', 'Segoe UI Symbol', '宋体', '新宋体', 'SimSun-ExtB', 'Sitka Small', 
    *'Sitka Text', 'Sitka Subheading', 'Sitka Heading', 'Sitka Display', 'Sitka Banner', 
    *'Sylfaen', 'Symbol', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana', 'Webdings', 
    *'Wingdings', 'Yu Gothic', 'Yu Gothic UI', '等线', '仿宋', '楷体', '黑体', 
    *'HoloLens MDL2 Assets', 'icomoon', 'MT Extra', 'Marlett', 'default']
    
    FontWithSize := Font[1]+'-Bold-40'
    *设置字体
    *Font[]    字体
    * -40      字体大小
    *-Bold     加粗
    *-Italic   斜体
    
    set_font (WindowHandle, FontWithSize)
    *设置用于文本输出的字体
    
    set_tposition (WindowHandle, Height/2, Width/2)
    *设置文本光标的位置
    *参数1:窗口文本
    *参数2:行坐标
    *参数3:列坐标
    
    string:='塘沽五中'
    write_string (WindowHandle, string)
    *在窗口中打印文本

    在Qt Creator中

      HObject  ho_Image;
      HTuple  hv_Width, hv_Height, hv_WindowHandle;
      HTuple  hv_Font, hv_FontWithSize, hv_string;
      ReadImage(&ho_Image, "D:/bb/tu/ma.jpg");
      GetImageSize(ho_Image, &hv_Width, &hv_Height);
      SetWindowAttr("background_color","black");
      OpenWindow(0,0,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
      HDevWindowStack::Push(hv_WindowHandle);
      if (HDevWindowStack::IsOpen())
        DispObj(ho_Image, HDevWindowStack::GetActive());
      QueryFont(hv_WindowHandle, &hv_Font);
      //返回可用字体
      //参数2:返回可用字体
      //['Arial', 'Bahnschrift', 'Calibri', 'Cambria', 'Cambria Math', 'Candara', 'Comic Sans MS',
      //'Consolas', 'Constantia', 'Corbel', 'Courier New', 'Ebrima', 'Franklin Gothic', 'Gabriola',
      //'Gadugi', 'Georgia', 'Impact', 'Ink Free', 'Javanese Text', 'Leelawadee UI', 'Lucida Console',
      //'Lucida Sans Unicode', 'Malgun Gothic', 'Microsoft Himalaya', 'Microsoft JhengHei',
      //'Microsoft JhengHei UI', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Sans Serif',
      //'Microsoft Tai Le', '微软雅黑', 'Microsoft YaHei UI', 'Microsoft Yi Baiti', 'MingLiU-ExtB',
      //'PMingLiU-ExtB', 'MingLiU_HKSCS-ExtB', 'Mongolian Baiti', 'MS Gothic', 'MS UI Gothic',
      //'MS PGothic', 'MV Boli', 'Myanmar Text', 'Nirmala UI', 'Palatino Linotype',
      //'Segoe MDL2 Assets', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Emoji',
      //'Segoe UI Historic', 'Segoe UI Symbol', '宋体', '新宋体', 'SimSun-ExtB', 'Sitka Small',
      //'Sitka Text', 'Sitka Subheading', 'Sitka Heading', 'Sitka Display', 'Sitka Banner',
      //'Sylfaen', 'Symbol', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana', 'Webdings',
      //'Wingdings', 'Yu Gothic', 'Yu Gothic UI', '等线', '仿宋', '楷体', '黑体',
      //'HoloLens MDL2 Assets', 'icomoon', 'MT Extra', 'Marlett', 'default']
    
      hv_FontWithSize = HTuple(hv_Font[1])+"-Bold-40";
      //设置字体
      //Font[]    字体
      //-40      字体大小
      //-Bold     加粗
      //-Italic   斜体
    
      SetFont(hv_WindowHandle, hv_FontWithSize);
      //设置用于文本输出的字体
    
      SetTposition(hv_WindowHandle, hv_Height/2, hv_Width/2);
      //设置文本光标的位置
      //参数1:窗口文本
      //参数2:行坐标
      //参数3:列坐标
    
      hv_string = //'塘沽五中'
          "\345\241\230\346\262\275\344\272\224\344\270\255";
      WriteString(hv_WindowHandle, hv_string);
      //在窗口中打印文本

  • 相关阅读:
    剑指Offer:数组中的逆序对
    Java高并发教程:Java NIO简介
    Java高并发教程:高并发IO的底层原理
    算法相关——Java排序算法之希尔排序(五)
    Materialized View模式
    Java技术——Java中的static关键字解析
    算法相关——Java排序算法之插入排序(四)
    Android Studio 2.2新增布局——ConstraintLayout完全解析
    公平锁与非公平锁
    Java线程和多线程(十五)——线程的活性
  • 原文地址:https://www.cnblogs.com/liming19680104/p/16201447.html
Copyright © 2020-2023  润新知