ios7 之前,如下:
objective-c
nsstring *str = @"hello world"
[str drawinrect:
cgrectmake(10,
10,300, 30)
withfont:
[uifont
fontwithname:@
"courier"
size
:kcellfontsize]
linebreakmode:
nslinebreakbytruncatingtail
alignment:
nstextalignmentright ]
nsparagraphstyleattributename
此屬性的值是nsparagraphstyle
物件。此屬性用於將多個屬性應用到的文字的範圍。如果不指定此特性的字串使用的預設段落屬性,返回的defaultparagraphstyle
方法的nsparagraphstyle
。
uifont
*font =[
uifont
fontwithname:@
"courier"
size
:kcellfontsize
];/// make a copy of the default paragraph style
nsmutableparagraphstyle
*paragraphstyle =[[
nsparagraphstyle
defaultparagraphstyle
]mutablecopy
];/// set line break mode
paragraphstyle
.linebreakmode
=nslinebreakbytruncatingtail
;/// set text alignment
paragraphstyle
.alignment
=nstextalignmentright
;nsdictionary
*attributes =@
;[text drawinrect
:rect withattributes
:attributes
];
QT文字繪製
1 基本繪製 qpainter painter this 這個this要斟酌下 painter.drawtext 100,100,yafeilinux 2 中級繪製 qpainter painter this qrectf ff 100,100,300,200 設定乙個矩形 painter.draw...
OPENGL繪製文字
opengl沒有提供直接繪製文字的功能,需要借助於作業系統。用opengl繪製文字比較常見的方法是利用顯示列表。建立一系列顯示列表,每個字元對應乙個列表編號。例如,a 對應列表編號1000 a b 對應列表編號1000 b 以此類推。繪製乙個字串時,依次呼叫字串中每個字元所對應的列表編號。在wind...
Qt繪製文字
1 基本繪製 qpainter painter this 這個this要斟酌下 painter.drawtext 100,100,yafeilinux 2 中級繪製 qpainter painter this qrectf ff 100,100,300,200 設定乙個矩形 painter.draw...