FontView 3

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 3

Post by rbytes »

This is a big update. I am hoping this program can now run universally on all Windows devices. But it may need more tweaking.
Please give it a try and let me know how it works for you.

As you can see in the screenshot, I told FontView 3 to run on a 96 dpi screen instead of my actual tablet dpi of 144. Everything shrank by the right amount to fit. :lol:

Code: Select all

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

V3 resizes the interface to work
on any Windows 10 device

V2 improves the layout and improves
the button functions
''

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

x,y = #.scrsize()
dp = #.scrdpi()
rw = dp/144 ; rh = dp/144
z = #.int(46*rw)
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*rw,20*rh,360*rw,366*rh)
t = #.textbox
> g, 1..n
  d += g+": "+ l[g] + #.lf
<
t.width = 360*rw ; t.height = 346*rh ; t.text = d
t.x = 20*rw ; t.y = 20*rh ; t.multi = 1
#.show(t)

' create button template
h = #.button ; h.height = 50*rh
h.width = 100*rw ; h.y = 70*.rh

' create buttons from template
f,j,k = h ; f.x = 600*rw
j.x = 750*rw ; k.x = 900*rw
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 = 360*rw ; sh.y = 710*rh
sh.size = 600*rw ; sv.x = 360*rw
sv.y = 760*rh ; sv.value = 18*rw
sv.size = 600*rw
#.show(sh,sv)
#.fontsize = #.int(35*rw)
#.drawtext(180*rw,690*rh,"FONT NAME")
#.drawtext(180*rw,740*rh,"FONT SIZE")

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

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

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

  ? #.act(sv)     ' size slider
    z = #.int((sv.value*2 + 10)*rw)
    print <->
  .

  ? #.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*rw,267*rh,1198*rw,363*rh)
    #.fontsize(46*rw)
    #.fontname(l[q+1])
    ? l[q+1] = "Gabriola" & z > 120
        base=-90*rh
    ! 
        base=0
    .
    #.drawtext(460*rw,275*rh,l[q+1])
    #.fillrect(0*rw,390*rh,x,y-120)
    #.fontsize(z)
    #.drawtext(20*rw,400*rh+base,e)
    #.fillrect(680*rw,210*rh,820*rw,260*rh)
    #.fillrect(1020*rw,210*rh,1198*rw,260*rh)
    #.fontsize(#.int(35*rw))
    #.fontname(#.default)
    #.drawtext(695*rw,205*rh,q+1)
    #.drawtext(1060*rw,205*rh,z)

<-
Attachments
Screenshot (61).png
Screenshot (61).png (62.92 KiB) Viewed 2653 times
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 3

Post by Mr. Kibernetik »

Here you have a very strange scaling approach.
Instead of this:

Code: Select all

dp = #.scrdpi()
rw = dp/144 ; rh = dp/144
I would suggest this:

Code: Select all

rw = x/1220 ; rh = y/800
in order to scale into screen dimensions, not into dpi.

Also I see here a bug in #.scrview function, I will fix it.

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 3

Post by rbytes »

Yes dpi turned out not to be the answer. It seems that Windows already does some sort of scaling, because my previous version of FontView (version 2) created on my tablet fit my laptop screen almost perfectly. Only the bottom slider was off-screen, exactly as you saw on your laptop.

I realized right away that there was no way dpi would help this situation, since there is no way of getting separate horizontal and vertical dpi values.

Your calculation method way well be the right one. It is similar to the scaling system I developed for Smart Basic.

To get a perfect fit on my laptop screen, all I did was remove all of the "dpi" code lines at the start of FontView 3. Right below the #.scrsize() line, I added this line:

rw=1 ; rh=.8

The program then fit my laptop perfectly.
The only thing that gets me down is gravity...

Post Reply