Announcement

Collapse
No announcement yet.

How To Post Text data On Dos With Different Font Size

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Post Text data On Dos With Different Font Size

    Query is:

    1. I Want To Print some Text any matter in the Dos mode using 'C' lang.
    Ex of TEXT to be printed is on DOS mode is . Hello friends

    2. The Text Which is Printed On Dos Mode using 'C' lang..
    can able to Print in the different Fonts
    2. That is using some 'C' function, I want to pass the parametes to functions(Text is to printed,font size ,font style).
    3. The output Text of the Function should be in the Font given as parameter. Printed on dos mode

  • #2
    Hi Sridhar,

    Unfortunately, this is generally the wrong place to come for advice on C-language programming, since this is a PowerBASIC BBS.

    That said, what you are wanting to do will firstly have to be customized for every type of printer your code will be using (Epson, IBM, PCL (HP), Diablo, Star, etc), since font control will be dictated by the printers ability to perform that operation.

    In addition, since your code will need to send control sequences intermixed with the print data, you'll find that it simply won't work with modern Windows-only (GDI) printers.

    However, the first suggested solution you could investigate is my DOSPRINT utility - it sounds like it might just fit your needs exactly as DOSPRINT was written specifically to help with these kinds of tasks.

    With DOSPRINT, your code only needs to use Epson control codes, and provided Windows 95 or better is running, DOSPRINT will "translate" the print job into a Windows print job that will print on any brand/model/connection of printer that has a Windows printer driver installed (be it Serial, USB, Parallel, network, etc). Once you pass the print job to DOSPRINT, it takes care of the rest of the details for you.

    DOSPRINT allows you to specify fonts and font attributes (size, bold, italic, etc) and can also print graphic images (BMP/JPG/PNG/TIF/TGA/GIF/WMF), and includes a Print Preview mode too!

    You can download a fully-functional demonstration version of DOSPRINT from http://www.dosprint.com

    For use with C, you'd launch DOSPRINT using the 'exec' or 'system' functions (I *think* that is the C-equivalent of SHELL in BASIC).

    The next possible solution is for you to use a Windows compiler to write a print engine that can be launched from your DOS application (which is precisely what DOSPRINT does!). This is not a trivial task though, so the cost of DOSPRINT might be quite economical in comparison. However, if you are interested, I have help you with some PB/DLL or PB/CC code (both are Windows compilers) to get you started with device context handling, font creation, etc. I don't have any C code for this though... sorry!

    I hope this helps!

    Regards,
    Lance
    http://www.dosprint.com
    Lance
    mailto:[email protected]

    Comment


    • #3


      tri this.


      'gary.bas by gary russell
      DECLARE SUB NORMAL0 ()
      DECLARE SUB LAYER2 ()
      DECLARE SUB LAYER1 ()
      DECLARE SUB TRANSLATE ()
      DECLARE SUB LETTERS ()

      DEFINT A-Z '
      DIM P$(122)
      SHARED P$()
      SHARED P$, SIZE$
      SHARED C1$, C2$, C3$
      SHARED C4$, BGC, DOT$
      SHARED SPACING$, WORD$
      SHARED PFT, PFL
      CALL LETTERS '
      SCREEN 9 '''''''''''''''''''''

      EFFECT1:
      LINE (1, 1)-(590, 72), 4, BF
      LINE (202, 3)-(588, 70), 1, BF
      WORD$ = "GARY RUSSELL" '
      SPACING$ = "L1"
      SIZE$ = "24" '
      DOT$ = "N" '
      BGC = 4 '
      CALL TRANSLATE '
      C1$ = "C14": C2$ = "C 8": C3$ = "C 0": C4$ = "C15" '
      PFT = 52: PFL = 13: CALL LAYER1 '
      PFT = 52: PFL = 9: CALL LAYER1 '
      PFT = 51: PFL = 10: CALL LAYER1 '
      PFT = 51: PFL = 11: CALL LAYER1
      t$ = INPUT$(1)

      EFFECT2:
      LINE (3, 78)-(494, 130), 13, B
      LINE (5, 80)-(492, 128), 7, BF
      WORD$ = "DAVID RUSSELL"
      SPACING$ = "L1"
      SIZE$ = "20"
      DOT$ = "N"
      BGC = 7
      CALL TRANSLATE
      C1$ = "C 5": C2$ = "C 8": C3$ = "C 8": C4$ = "C 8"
      PFT = 117: PFL = 17: CALL LAYER2
      PFT = 117: PFL = 15: CALL LAYER2
      PFT = 117: PFL = 13: CALL LAYER2
      C1$ = "C 5": C2$ = "C 0": C3$ = "C 0": C4$ = "C15"
      PFT = 115: PFL = 19: CALL LAYER2
      PFT = 115: PFL = 18: CALL LAYER2
      t$ = INPUT$(1)

      EFFECT3:
      LINE (3, 136)-(178, 192), 8, BF
      LINE (3, 136)-(415, 192), 9, B
      WORD$ = "JAMES RUSSELL"
      SPACING$ = "L1"
      SIZE$ = "16"
      DOT$ = "N"
      BGC = 8
      CALL TRANSLATE
      C1$ = "C 0": C2$ = "C 0": C3$ = "C 0": C4$ = "C 0"
      PFT = 167: PFL = 12: CALL LAYER1
      C1$ = "C 8": C2$ = "C 7": C3$ = "C15": C4$ = "C 0"
      PFT = 167: PFL = 13: CALL LAYER2
      PFT = 167: PFL = 12: CALL LAYER2
      PFT = 166: PFL = 13: CALL LAYER2
      PFT = 167: PFL = 11: CALL LAYER2
      t$ = INPUT$(1)

      EFFECT4:
      LINE (2, 206)-(636, 303), 12, BF
      LINE (1, 204)-(639, 306), 15, B
      LINE (19, 280)-(620, 280), 14, B
      LINE (20, 281)-(619, 281), 0, B
      LINE (21, 282)-(618, 282), 0, B
      WORD$ = "JOHN RUSSELL"
      SPACING$ = "L1"
      SIZE$ = "28"
      DOT$ = "N"
      BGC = 12
      CALL TRANSLATE
      C1$ = "C12": C2$ = "C 4": C3$ = "C 0": C4$ = "C 0"
      PFT = 266: PFL = 24: CALL LAYER1
      C1$ = "C12": C2$ = "C 4": C3$ = "C 0": C4$ = "C 0"
      PFT = 265
      FOR XX = 25 TO 33 STEP 2
      PFL = XX: CALL LAYER1
      PFT = PFT - 1
      NEXT
      C1$ = "C15": C2$ = "C 6": C3$ = "C 6": C4$ = "C14"
      PFT = 259: PFL = 40: CALL LAYER1
      PFT = 259: PFL = 36: CALL LAYER1
      PFT = 258: PFL = 38: CALL LAYER1
      t$ = INPUT$(1)

      ALPHABET:
      LINE (1, 315)-(639, 331), 7, B
      LINE (2, 316)-(638, 330), 15, BF
      WORD$ = " THE RUSSELL BOYS MOMY JULIE ANN RUSSELL"
      SPACING$ = "R0"
      SIZE$ = "4"
      DOT$ = "N"
      BGC = 15
      CALL TRANSLATE
      C1$ = "C 1"
      PFT = 324: PFL = 5: CALL NORMAL0
      t$ = INPUT$(1)

      SUB LAYER1
      PSET (PFL + 2, PFT + 5), BGC: DRAW C3$ + P$
      PSET (PFL + 0, PFT + 5), BGC: DRAW C3$ + P$
      PSET (PFL + 1, PFT + 5), BGC: DRAW C3$ + P$
      PSET (PFL + 0, PFT + 4), BGC: DRAW C3$ + P$
      PSET (PFL + 1, PFT + 2), BGC: DRAW C2$ + P$
      PSET (PFL + 2, PFT + 4), BGC: DRAW C1$ + P$
      PSET (PFL + 3, PFT + 3), BGC: DRAW C4$ + P$
      PSET (PFL + 3, PFT + 2), BGC: DRAW C2$ + P$
      PSET (PFL + 4, PFT + 4), BGC: DRAW C2$ + P$
      PSET (PFL + 5, PFT + 2), BGC: DRAW C3$ + P$
      PSET (PFL + 5, PFT + 3), BGC: DRAW C2$ + P$
      PSET (PFL + 4, PFT + 3), BGC: DRAW C1$ + P$
      END SUB

      SUB LAYER2
      PSET (PFL + 0, PFT + 5), BGC: DRAW C4$ + P$
      PSET (PFL + 0, PFT + 3), BGC: DRAW C4$ + P$
      PSET (PFL + 2, PFT + 3), BGC: DRAW C1$ + P$
      PSET (PFL + 1, PFT + 2), BGC: DRAW C1$ + P$
      PSET (PFL + 2, PFT + 4), BGC: DRAW C4$ + P$
      PSET (PFL + 3, PFT + 3), BGC: DRAW C3$ + P$
      PSET (PFL + 3, PFT + 2), BGC: DRAW C1$ + P$
      PSET (PFL + 4, PFT + 4), BGC: DRAW C1$ + P$
      PSET (PFL + 5, PFT + 2), BGC: DRAW C1$ + P$
      PSET (PFL + 5, PFT + 3), BGC: DRAW C2$ + P$
      PSET (PFL + 4, PFT + 3), BGC: DRAW C1$ + P$
      END SUB

      SUB LETTERS
      P$(32) = "BR4" 'space
      P$(65) = "BD1U7E1R3F1D3L5R5D4BR4BU1" 'A
      P$(66) = "BD1U8R4F1D2G1L4R4F1D2G1L4BU1BR9" 'B
      P$(67) = "BD1BU1U6E1R3F1BD6G1L3H1F1R3BR4BU1" 'C
      P$(68) = "BD1U8R4F1D6G1L4BR9BU1" 'D
      P$(69) = "BD1U8R4L4D4R3L3D4R4BU1BR4" 'E
      P$(70) = "BD1U8R5L5D4R4L4D4BR8BU1" 'F
      P$(71) = "BD1BU1U6E1R3F1BD6G1L3H1F1R3E1U3L2RD3BR4" 'G
      P$(72) = "BD1U8D4R4U4D8BR4BU1" 'H
      P$(73) = "BD1BR1U8L1R2L1D8L1R2BR4BU1" 'I
      P$(74) = "BD1BU1F1R2E1U7L1R2L1D7BR5" 'J
      P$(75) = "BD1BU8D8U4R1E4G4F4BR4BU1" 'K
      P$(76) = "BD1BU8D8R4BU1BR4" 'L
      P$(77) = "BD1U7E1R2F1D7U7E1R2F1D7BU1BR4" 'M
      P$(78) = "BD1U8F7D1U8D8BR4BU1" 'N
      P$(79) = "BD1BU1U6E1R3F1BD6G1L3H1BR5U6D6BR4" 'O
      P$(80) = "BD1U8R4F1D2G1L4D4BR9BU1" 'P
      P$(81) = "BD1BU1U6E1R3F1BD6G1L3H1BR5U6BL3BD5F3BG3BR7BU5" 'Q
      P$(82) = "BD1U8R4F1D2G1L4R1F4BR4BU1" 'R
      P$(83) = "BD1BU5U2E1R3F1BD2BL5F1R3F1D2G1L3H1BR9" 'S
      P$(84) = "BR3BD1BU8L4R6L3D8BR6BU1" 'T
      P$(85) = "BD1BU1U7D7F1R3E1U7D7BR4" 'U
      P$(86) = "BD1BU8D5F2D1U1E2U5D5BR5BD2" 'V 'P$(86) = "BD1BU8D5F2D1U1E2U5D5BR5BD2"
      P$(87) = "BD1BU1U7D7F1R2E1U7D7F1R2E1U7D7BD1BR4BU1" 'W
      P$(88) = "BD1BU8D1F3E3U1D1G6D1U1E3F3D1BU1BR5" 'X
      P$(89) = "BL1BU5U2D2F3E3U2D2G3D3BU1BR7" 'Y
      P$(90) = "BU7R5D2G5D1R5BR4BU1" 'Z
      END SUB

      SUB NORMAL0
      PSET (PFL + 0, PFT + 0), BGC: DRAW C1$ + P$
      END SUB

      SUB TRANSLATE
      SPACING$ = "B" + UCASE$(SPACING$)
      SIZE$ = "S" + UCASE$(SIZE$)
      P$(105) = "BR0BD1U6BU2BD7BR4" 'i
      P$(106) = "BR1BD1U6BU2BD7D3G1L2BU4BR8" 'j
      IF DOT$ = "Y" THEN P$(105) = "BR0BD1U6BU1U1BD7BR4"
      IF DOT$ = "Y" THEN P$(106) = "BR1BD1U6BU1U1BD7D3G1L2BU4BR8"
      P$ = SIZE$
      FOR J = 1 TO LEN(WORD$)
      P$ = P$ + P$(ASC(MID$(WORD$, J, 1))) + SPACING$
      NEXT J
      END SUB



      ------------------

      Comment


      • #4
        Sridhar says "print" which I took to mean on <U>paper</U>, and Gary's obviously takes it to mean on the <U>screen</U>?!

        Between us we have probably covered some of the bases, but we have probably not solved the C-language requirement he mentions.


        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        Working...
        X