blob: 71829e049d7fd0c9b735891bacd7f6c20cc7e29d (
plain) (
blame)
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
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <gki.h>
include "stdgraph.h"
# STG_TXSIZE -- Given the relative character size as a packed real, select
# the discreet closest device character size.
int procedure stg_txsize (pksize)
int pksize # packed real relative character size
int i, best_size
real txsize, diff, least_diff
include "stdgraph.com"
begin
txsize = GKI_UNPACKREAL (pksize)
best_size = 1
least_diff = abs (txsize - SG_CHARSIZE(g_sg,1))
do i = 2, SG_NCHARSIZES(g_sg) {
diff = abs (txsize - SG_CHARSIZE(g_sg,i))
if (diff < least_diff) {
best_size = i
least_diff = diff
}
}
return (best_size)
end
|