FontView

Post Reply
User avatar
rbytes
Posts: 1963
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

FontView

Post by rbytes » Fri Sep 22, 2017 9:07 pm

View all of the fonts on your device at any size.

Code: Select all

''
FontView by rbytes
September 2017
View all of the fonts on your device
at any size you wish.
''


x,y = #.scrsize()
z = 40
q = 0
#.scrclear(.8,.8,.8)
#.drawcolor(0,0,1)
#.fillcolor(.8,.8,.8)
p = #.array(300)
e = z + " : The Quick Brown Fox Jumps Over The Lazy Dog"
l = #.fontlist()
n = #.size(l,1)
'#.output(n)
#.drawsize(2)
#.drawrect(20,20,380,440)
t = #.textbox
> g, 1..n
  d += l[g] + #.lf
<
t.width = 360
t.height = 420
t.text = d
t.x = 20
t.y = 20
t.multi = 1
#.show(t)

' create button template
h = #.button
h.height = 50
h.width = 100
h.y = 200

' create buttons from template
f,j,k = h
f.x = 550
j.x = 700
k.x = 850
f.text = "S T O P"
j.text = "P R E V"
k.text = "N E X T"
#.show(f,j,k)


' create sliders
sh,sv = #.slider  ' font name slider and size slider
sh.x = 600
sh.y = 100
sh.size = 600
sv.x = 600
sv.y = 150
sv.value = 15
sv.size = 600
#.show(sh,sv)
#.drawtext(450,85,"FONT NAME")
#.drawtext(450,135,"FONT SIZE")

' show first font in list
#.drawrect(450,300,1200,400)
#.fontname(l[1])
#.fontsize(40)
#.drawtext(460,310,l[1])
#.drawtext(20,500,e)

' main program loop
>
  ? #.act(sh)     ' font name slider
    q = (sh.value*(n-1))/100 
    print <->
  .

  ? #.act(sv)     ' size slider
    z = sv.value*2 + 10
    #.fillrect(0,450,x,y)
    #.fontsize(z)
    e = z + " : The Quick Brown Fox Jumps Over The Lazy Dog"
    #.drawtext(20,500,e)
  .

  ? #.act(f)      ' stop button
    #.end()
  .

  ? #.act(j)      ' prev button
    ? q > 0
      q -= 1
      print <->
    .
  .
 
  ? #.act(k)      ' next button
    ? q < n -1
      q += 1
      print <->
    .
  .
<

:print ' draw font subroutine
    #.fillrect(452,302,1198,398)
    #.fontsize(40)
    #.fontname(l[q+1])
    #.drawtext(460,310,l[q+1])
    #.fillrect(0,450,x,y)
    #.fontsize(z)
    #.drawtext(20,500,e)
<-
Attachments
Screenshot (59).png
Screenshot (59).png (115.68 KiB) Viewed 1027 times
Zzzzz

Post Reply