Text Only
|
Text with Attachments
QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Theo on December 20, 2019, 02:48:54 pm
Title:
printing
Post by:
Theo
on
December 20, 2019, 02:48:54 pm
I hope a for a command in the next version, for to print in print in bold and double height. Sorry for my bad english, this is translated by Google
Title:
Re: printing
Post by:
Petr
on
December 20, 2019, 04:30:01 pm
Hi Theo,
Try using this https://www.qb64.org/forum/index.php?topic=1958.msg111894#msg111894
Title:
Re: printing
Post by:
SMcNeill
on
December 20, 2019, 04:32:25 pm
If you want to print to the screen, just use _LOADFONT and _FONT. If you’re wanting to print to paper, use _PRINTIMAGE.
Edit: Changed name to proper syntax, as pointed out by Fell below. ;)
Title:
Re: printing
Post by:
FellippeHeitor
on
December 20, 2019, 05:18:41 pm
Code: QB64:
[Select]
_PRINTIMAGE
Title:
Re: printing
Post by:
Theo
on
December 21, 2019, 07:27:36 am
Thanks for the reply
I gone try all the comments
Thanks
Title:
Re: printing
Post by:
bplus
on
December 21, 2019, 10:05:47 am
Here is a way use the default font to any size:
Code: QB64:
[Select]
OPTION
_EXPLICIT
_TITLE
"Text sub tests"
'B+ started 2019-03-25 mod 2019-12-21 twice
RANDOMIZE
TIMER
CONST
xmax
=
1200
CONST
ymax
=
700
SCREEN
_NEWIMAGE
(
xmax
,
ymax
,
32
)
_SCREENMOVE
100
,
40
DIM
y
,
i
COLOR
_RGB32
(
0
,
0
,
255
)
,
&HFFFFFFFF
CLS
PRINT
"Hello World, press any for Text sizing demo..."
SLEEP
y
=
ymax
FOR
i
=
1
TO
15
STEP
.5
CLS
y
=
y
-
60
/
i
cText xmax
/
2
,
y
,
240
/
i
,
_RGB32
(
255
,
0
,
0
)
,
"So how is this looking?"
_DISPLAY
_LIMIT
2
NEXT
cText
600
,
60
,
32
,
&HFFFFBB00
,
"Hello World in orange at 2 X's normal font height."
LOCATE
30
,
1
:
PRINT
"And this Back to normal PRINT and current color with this line... press any to end demo."
_DISPLAY
SLEEP
SYSTEM
SUB
Text
(
x
,
y
,
textHeight
,
K
AS
_UNSIGNED
LONG
,
txt$
)
DIM
fg
AS
_UNSIGNED
LONG
,
cur&
,
I&
,
mult
,
xlen
fg
=
_DEFAULTCOLOR
'screen snapshot
cur&
=
_DEST
I&
=
_NEWIMAGE
(
8
*
LEN
(
txt$
)
,
16
,
32
)
_DEST
I&
COLOR
K
,
_RGBA32
(
0
,
0
,
0
,
0
)
_PRINTSTRING
(
0
,
0
)
,
txt$
mult
=
textHeight
/
16
xlen
=
LEN
(
txt$
)
*
8
*
mult
_PUTIMAGE
(
x
,
y
)
-
STEP
(
xlen
,
textHeight
)
,
I&
,
cur&
COLOR
fg
_FREEIMAGE
I&
END
SUB
'center the text
SUB
cText
(
x
,
y
,
textHeight
,
K
AS
_UNSIGNED
LONG
,
txt$
)
DIM
fg
AS
_UNSIGNED
LONG
,
cur&
,
I&
,
mult
,
xlen
fg
=
_DEFAULTCOLOR
'screen snapshot
cur&
=
_DEST
I&
=
_NEWIMAGE
(
8
*
LEN
(
txt$
)
,
16
,
32
)
_DEST
I&
COLOR
K
,
_RGBA32
(
0
,
0
,
0
,
0
)
_PRINTSTRING
(
0
,
0
)
,
txt$
mult
=
textHeight
/
16
xlen
=
LEN
(
txt$
)
*
8
*
mult
_PUTIMAGE
(
x
-
.5
*
xlen
,
y
-
.5
*
textHeight
)
-
STEP
(
xlen
,
textHeight
)
,
I&
,
cur&
COLOR
fg
_FREEIMAGE
I&
END
SUB
Update: fixed up demo, sizing does not work well really small like Richard Frost's
Text Only
|
Text with Attachments