b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

pango markup_markup公式_markup用法(4)

电脑杂谈  发布时间:2017-06-08 15:06:17  来源:网络整理

pango markup_markup公式_markup用法

As the two images below show, you can set the width of your pango layout so that text is output within a narrow or wide space. To do this, you simply call the set_width method in pango.Layout.

The sample code below shows how this is done. Note how the width argument itself is in relatively large units (at least for sugar-jhbuild).

import pango
...
class TextWidget(gtk.DrawingArea):
	def __init__(self):
                ...
		#create a pango layout. Leave text argument to be empty string since we want to use markup
		self.pango_context = self.create_pango_context()
		self.pango_layout = self.create_pango_layout('')

		#Make the width of the pango layout to be relatively narrow
		self.pango_layout.set_width(200000)

		#Make the width of the pango layout to be relatively wide. 
		self.pango_layout.set_width(800000)
                ...

There are two ways in which you can customize how fonts are displayed in your activity.

You set th default font properties throughout your layout.

Using Pango markup, you customize specific blocks of text in your Pango layout.

To customize the default font throughout your layout, you call the method when you create and initialize your Pango layout.

import pango
...
		#create a pango layout. Leave text argument to be empty string since we want to use markup
		self.pango_context = self.create_pango_context()
		self.pango_layout = self.create_pango_layout('')

		#Set the default font style for this pango layout
		self.pango_layout.set_font_description(pango.FontDescription('serif Ultra-bold italic 14'))


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-51835-4.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...