Brew教程之Brew中文字自动换行

来源:yarin's blog™ 责任编辑:栏目编辑 发表时间:2013-07-02 04:55 点击:

本来是个很简单的问题,既然有人问,就写在这里吧!
已经实现的函数,可以直接使用!

  1. //在指定矩形中输出文字     
  2. void DrawTextInRect( IDisplay *m_pIDisplay,     
  3.                    AEEFont font,     
  4.                    RGBVAL r gb,     
  5.                    AECHAR *pText,     
  6.                    const AEERect *pRect )     
  7. {     
  8.     if( !pText )     
  9.     {     
  10.          return;     
  11.     }     
  12.     RGBVAL rgb_old = IDISPLAY_SetColor( m_pIDisplay, CLR_USER_TEXT, rgb );     
  13.     int8 text_height;     
  14.     AECHAR *text_pos = pText;     
  15.     text_height= IDISPLAY_GetFontMetrics( m_pIDisplay, font, NULL, NULL ) + LINEBLANK;     
  16.     int16 pos_y;     
  17.     for( pos_y = pRect->y; pos_y <= pRect->y + pRect->dy - text_height; pos_y = pos_y + text_height )     
  18.     {     
  19.         int draw_num;     
  20.         IDISPLAY_MeasureTextEx( m_pIDisplay, font, text_pos, -1,pRect->dx, &draw_num );     
  21.         IDISPLAY_DrawText( m_pIDisplay, font, text_pos, draw_num,pRect->x, pos_y, NULL, IDF_TEXT_TRANSPARENT );     
  22.        
  23.          text_pos += draw_num;     
  24.          if( *text_pos == NULL )     
  25.         {     
  26.             IDISPLAY_SetColor( m_pIDisplay, CLR_USER_TEXT, rgb_old );     
    • 相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • Android 完全退出程序
      • 原创:Android应用开发-Andorid歌词秀,含源码
      • android 屏幕保护
      • Android手机软件汉化教程---第四课 dex文件汉化
      • 众多Android 开源项目推荐,给力工作给力学习
      • Android Audio代码分析4
      • Android得到已安装的应用程序信息!
      • Android开发者指南(29) —— USB Host and Accessory
      • Android成长的幕后推手:工程师鲁宾
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1