Paul,PaulR wrote:Thanks for that seaside - what if you run the executable in my last post without recompiling?
Paul
That is a pic of your last posted executable
It was run on precise 5.4.3 at Xft.dpi: 96.
Cheers,
s
Code: Select all
REM try to set font size to fit window... ex: xdpy=107 xftdpi=78
xdpi=VAL(EXEC$("xdpyinfo | grep -o 'resolution: .*' | tr -s ' ' | cut -f 2 -d ' ' | cut -f 1 -d 'x'"))
xftdpi=VAL(EXEC$("grep '^Xft.dpi:.*' /root/.Xresources | tr -s ' ' | cut -f 2 -d ' '"))
REM my weird formula...
fontsize=INT(12.0*(78.0/xftdpi)*(107.0/xdpi))
fontsize_mono=fontsize
fontsize$=STR$(fontsize)
fontsize_mono$=STR$(fontsize_mono)
font_sans$=CONCAT$("DejaVu Sans ",fontsize$)
font_mono$=CONCAT$("Monospace ",fontsize_mono$)
PRINT xdpi
PRINT xftdpi
PRINT fontsize
PRINT font_mono$
PRINT font_sans$
Code: Select all
' *****************
' DECLARATIONS
' *****************
GLOBAL hres, vres, dsize, dpi, mydpi TYPE FLOATING
GLOBAL version$ TYPE STRING
' *****************
' END DECLARATIONS
' *****************
' *****************
' INIT VARS
' *****************
version$ = "v. 0.1"
' *****************
' END INIT VARS
' *****************
' *****************
' FUNCTIONs
' *****************
FUNCTION CALCDPI(FLOATING hres, FLOATING vres, FLOATING dsize)
dpi = hres/(hres / SQR(POW(hres,2) + POW(vres,2)) * dsize)
RETURN dpi
END FUNCTION
FUNCTION USAGE()
PRINT NL$,"BaCon DPI Calculator - ", version$,NL$
PRINT "Usage: dpicalc hres vres size", NL$
PRINT "Where:"
PRINT " hres = horizontal resolution in pixels"
PRINT " vres = vertical resolution in pixels"
PRINT " size = diag. size of screen in inches",NL$
PRINT "Example: dpicalc 1280 1024 19", NL$
END
RETURN TRUE
END FUNCTION
FUNCTION GETARGS()
SPLIT ARGUMENT$ BY " " TO array$ SIZE dimension
IF dimension < 4 THEN
USAGE
ELSE
IF VAL(array$[1]) > 0 AND VAL(array$[2]) > 0 AND VAL(array$[3]) > 0 THEN
hres = VAL(array$[1])
vres = VAL(array$[2])
dsize = VAL(array$[3])
ELSE
PRINT NL$, "DPI Calculator: Input arguments contain bad values."
USAGE
END IF
END IF
RETURN TRUE
END FUNCTION
FUNCTION SHOWRESULTS()
STR1$ = "Calculated DPI for screen resolution of "
PRINT NL$, STR1$, hres,"x",vres,"pixels and ",dsize, " in."," diagonal = ", mydpi, NL$
RETURN TRUE
END FUNCTION
' *****************
' END FUNCTIONS
' *****************
' *****************
' MAIN
' *****************
GETARGS
mydpi = CALCDPI(hres, vres, dsize)
SHOWRESULTS
END
' *****************
' END MAIN
' *****************
Do not know why. I only know that it has given the good result.linuxcbon wrote:Why 66 ?L18L wrote:I have inserted HUGOPTIONS("BASEXFTDPI 66") and compiled. See the result, your original and mine
So did I by using 66.Posted on 29 Mar 2013, 8:06 by BarryK wrote: re hug dpi
L18L,
I don't see any problem.
I solved that problem a long time ago:
http://bkhome.org/bacon/hug/layout.htm
Both /usr/share/doc/welcome1stboot.bac and /usr/local/simple_network_setup/proxy-setup.bac in Woof use that method.
Shame on all of us except BarryKL18L wrote:Do not know why. I only know that it has given the good result.linuxcbon wrote:Why 66 ?L18L wrote:I have inserted HUGOPTIONS("BASEXFTDPI 66") and compiled. See the result, your original and mine
So did I by using 66.Posted on 29 Mar 2013, 8:06 by BarryK wrote: re hug dpi
L18L,
I don't see any problem.
I solved that problem a long time ago:
http://bkhome.org/bacon/hug/layout.htm
Both /usr/share/doc/welcome1stboot.bac and /usr/local/simple_network_setup/proxy-setup.bac in Woof use that method.
And don't know why because PaulR has used 78.
quoted fromwho wrote:The same thing as shown above could also happen if a different GTK theme with larger font is chosen (see menu Desktop -> GTK theme chooser). Different users are going to have their own theme preference, but it isn't so good if a theme has bigger font sizes which cause our example window to be messed up.
There is also a simple solution to this. Peter introduced a feature that allows a font to be specified in the program, that overrides the GTK default. This will apply to all widgets. Put this near the beginning of the program:
HUGOPTIONS("FONT DejaVu Sans 12")
...with whatever font you want. DejaVu Sans is available in all puppies.
Code: Select all
HUGOPTIONS("BASEXFTDPI 78")
'set font size so
'windows/fonts will scale properly on other systems
HUGOPTIONS("FONT DejaVu Sans 9")