【SonicUI】關於字型高亮的問題。。,sonicui字型高亮

來源:互聯網
上載者:User

【SonicUI】關於字型高亮的問題。。,sonicui字型高亮



m_pSonicString[1]->Format(_T("/c=%x, a='http://hi.csdn.net/', linkh=0xFF00F0, font, font_height=25, font_bold=1, font_italic=1/點我開啟連結uM"),RGB(128,0,32));m_pSonicString[2]->Format(_T("/c=%x, a='http://hi.csdn.net/', linkh=0xFF00F0, font, font_height=25, font_bold=1, font_italic=0/點我開啟連結uM"),RGB(128,0,32));

測試代碼如上:

通過程式碼分析,發現了作者使用的是 API GetTextExtentPoint32

BOOL GetTextExtentPoint32(  HDC hdc,           // handle to DC  LPCTSTR lpString,  // text string  int c,      // characters in string  LPSIZE lpSize      // string size);

這個是函數是可以擷取到字串的寬度。。但是沒有區分Italic類型,所以才會出現以上高亮後的問題。。


if (block.Font.bItalic){UINT nChar = (UINT)block.strText.GetAt(strlen(block.strText) + -1);if (nChar >= 0xA0){nChar = ((UINT)block.strText.GetAt(strlen(block.strText) + -2) >> 8) + nChar;nChar = nChar & 0xFFFF;int nWidth;GetCharWidth32(hdc,nChar ,nChar ,&nWidth);nBlockWidth = sz.cx + nWidth;}else{ABC czAbc = {0};GetCharABCWidths(hdc,nChar,nChar,&czAbc);nBlockWidth = sz.cx - czAbc.abcC;}}else{nBlockWidth = sz.cx;}


\SonicUI_src\SonicUI\SonicString.cpp  477line     更改支援中英文。。


</pre><pre class="cpp" name="code">BOOL GetCharABCWidths(  HDC hdc,         // handle to DC  UINT uFirstChar, // first character in range  UINT uLastChar,  // last character in range  LPABC lpabc      // array of character widths);



通過這個函數擷取當前字型下,最後一個字元的寬度。。可以很好的完全顯示出來!





哪種瀏覽器可以設定字型高亮?

世界之窗瀏覽器(the word), 具體方法可以去官網論壇問問····
 
怎在ps 中得到 高亮文字?

你說的這種字型一般美工都會做,我叫它為“網頁字”
1.在ps功能表列中,視窗》字元 選中,會出現字元選項框
2.在選項框最下邊,“美國英語”旁邊,有個選項框,選“無”,就會出現這種情況了
注意:字型必須選宋體,12號字是效果最好的,也是網頁上用的最多的。
希望樓主早日解決問題!
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.