FontView 2

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

FontView 2

Post by rbytes »

My first version of FontView worked Ok, but the interface was not friendly. When I adjusted the sliders, my hand blocked the view of the changes happening beneath. Now the sliders are at the bottom, and it is easy to see the size and name changes. You still might wonder why I show a scrolling window of font names at the upper left. It looks like a list where you could scroll and select a name, but it isn't - yet. I'm sure that a list object will appear in an SPL update sometime soon. In the meantime, this window is just a search tool where you can scroll alphabetically to find the font you want, get its reference number, and then use the name slider to go to it. I notice that the slider sometimes skips over a name. This may be that it does not have enough resolution to get to every font number. I will look into this. The workaround is to get as close as you can to the font you want, then use PREV or NEXT to get to it.

***** NOTE ***** Font Name slider now updates its position correctly when PREV and NEXT buttons are used.

Code: Select all

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

' hide the control menu
'#.scrview(#.normal)

x,y = #.scrsize()
z = 46
q = 0
base = 0
#.scrclear(.8,.8,.8)
#.drawcolor(0,0,1)
#.fillcolor(.8,.8,.8)
p = #.array(300)
e = "The Quick Brown Fox Jumps Over The Lazy Dog"
l = #.fontlist()
n = #.size(l,1)
'#.output(n)
#.drawsize(2)
#.drawrect(20,20,360,366)
t = #.textbox
> g, 1..n
  d += g+": "+ l[g] + #.lf
<
t.width = 360
t.height = 346
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 = 70

' create buttons from template
f,j,k = h
f.x = 600
j.x = 750
k.x = 900
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 = 350
sh.y = 710
sh.size = 600
sv.x = 350
sv.y = 760
sv.value = 18
sv.size = 600
#.show(sh,sv)
#.drawtext(200,695,"FONT NAME")
#.drawtext(200,745,"FONT SIZE")

' show first font in list
#.drawrect(450,265,1200,365)
#.fontname(l[1])
#.fontsize(46)
#.drawtext(460,275,l[1])
#.drawtext(20,400+base,e)
'#.drawtext(20,420,e)

' show font reference number and point size
#.drawrect(450,205,1200,265)
#.fontsize(35)
#.fontname(#.default)
#.drawline(825,205,825,265)
#.drawtext(460,205,"Font Ref. #:")
#.drawtext(835,205,"Font Size:")
#.drawtext(685,205,q+1)
#.drawtext(1050,205,z)

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

  ? #.act(sv)     ' size slider
    z = sv.value*2 + 10
    print <->
    ''
    #.fillrect(0,400,x,y-140)
    #.fontsize(z)
    e = "The Quick Brown Fox Jumps Over The Lazy Dog"
    #.drawtext(20,400,e)
    #.fontsize(35)
    #.fillrect(1010,210,1198,260)
    #.drawtext(1050,205,z)
    ''
  .

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

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

:print ' draw font subroutine
    #.fillrect(452,267,1198,363)
    #.fontsize(46)
    #.fontname(l[q+1])
    ? l[q+1] = "Gabriola" & z > 120
        base=-90
    ! 
        base=0
    .
    #.drawtext(460,275,l[q+1])
    #.fillrect(0,390,x,y-120)
    #.fontsize(z)
    #.drawtext(20,400+base,e)
    #.fillrect(670,210,820,260)
    #.fillrect(1010,210,1198,260)
    #.fontsize(35)
    #.fontname(#.default)
    #.drawtext(685,205,#.int(q+1))
    #.drawtext(1050,205,z)

<-
Attachments
Screenshot (60).png
Screenshot (60).png (79.76 KiB) Viewed 3601 times
Last edited by rbytes on Sat Sep 23, 2017 7:12 pm, edited 1 time in total.
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: FontView 2

Post by Mr. Kibernetik »

rbytes wrote:
Sat Sep 23, 2017 4:52 pm
I'm sure that a list object will appear in an SPL update sometime soon.
Yes, list object is planned.
rbytes wrote:
Sat Sep 23, 2017 4:52 pm
This may be that it does not have enough resolution to get to every font number.
Yes, desired slider resolution will be available in next version: max, min and step properties will allow to achieve any precision.
Currently slider can return only 100 numbers.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: FontView 2

Post by Mr. Kibernetik »

My display cannot show all controls. I get only this:
image.PNG
image.PNG (37.66 KiB) Viewed 3597 times

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: FontView 2

Post by Mr. Kibernetik »

I am not sure it is important, but PREV/NEXT buttons do not affect FONT NAME slider.

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

Re: FontView 2

Post by rbytes »

You are right, the slider is not updated by the PREVIOUS and NEXT buttons. I will fix this in the next version. Also I am going to set up all the variables so that they can be scaled by DPI. I hope that will fix the display issue on your device. I haven't yet tried Font View on my laptop. Maybe today. I will probably have a worse problem! :o
The only thing that gets me down is gravity...

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

Re: FontView 2

Post by rbytes »

The slider update issue has been fixed in the original post above.
The only thing that gets me down is gravity...

Post Reply