Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw text with UGL

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to draw text on UGL. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

First, refer to the previous operation of opening the display device, use uglRegistryFind () to find the font engine; then use uglFontFindString () to find the desired font; use uglFontCreate () to create a local font; use uglFontSet () to tell the current graphic context; finally, use uglTextDraw () to draw the text

The code is as follows, but lines 5 or 6

Multiple local fonts can be created in an App. Just tell GC through uglFontSet () before drawing the text.

The foreground color of GC refers to the color of the pixels occupied by each stroke in the character; the background color is the color of the rectangular area occupied by each character.

If the color is not set for GC, then GC will use the previous value, and when the system starts up, the initial value of the GC member is 0, so it is black

There are several related functions.

When uglTextDraw () draws text, the characters are aligned to BaseLine by default, roughly the lower-left corner of each character. In general, App needs to be aligned to the upper left corner, so you can use uglFontDriverInfo () to set the starting position of the entire font when drawing characters.

Or use uglFontInfo () to set a single font

You can use uglFontMetricsGet () to query font details

Use uglTextSizeGet () to calculate the space occupied by a piece of text when using a font, which makes it easier to calculate the position of uglTextDrawW ()

If you want to use double-byte encoded Asian fonts (such as Chinese), use the matching uglTextSizeGetW () and uglTextDrawW

This is the end of the article on "how to draw text in UGL". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report