1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
-
|
|
!
-
|
|
!
| #include "llmod3/llmod3.hsp"
#module
#deffunc GetStrRect var intSize, var szword
mref outstat, 64
mref bmscr, 67
dim prm2
dim tm,56
prm2.0 = bmscr.4 getptr prm2.1, tm
dllproc "GetTextMetricsA", prm2, 2, D_GDI if stat = 0 : outstat = 0 : goto *@forward
dim prm1, 4
prm1.0 = prm2.0
getptr prm1.3, size
outstat = 1
intSizeW = 0 : intSizeH = 0
szTxt = szword
notesel szTxt
szTxtMax=noteinfo(0) repeat szTxtMax
noteget@ szLine,cnt getptr prm1.1, szLine prm1.2=strlen(szLine) dllproc "GetTextExtentPoint32A", prm1, 4, D_GDI
if stat {
if intSizeW<size.0 : intSizeW = size.0
}
else{
outstat = stat
break
}
intSizeH += tm.0 loop
intSize = intSizeW, intSizeH
*@
return
#global
font "MS Pゴシック", 36,16
s = "test\nあいうえお\n\n012"
dim intMojiSize, 2
GetStrRect intMojiSize, s
color 255,0,0
boxf ,, intMojiSize.0, intMojiSize.1
color 255,255,255
boxf 1,1, intMojiSize.0-1, intMojiSize.1-1
color 0,0,0
mes s
|