home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / documentation / documents / a252kern < prev    next >
Internet Message Format  |  1999-04-27  |  2KB

  1. From: arb@comp.lancs.ac.uk (Andrew Brooks)
  2. Subject: Re: kerning in Draw text areas
  3. Date: Fri, 26 Nov 1993 19:11:01 GMT
  4.  
  5. >Can some kind soul with the (RISCOS3) PRMs tell me the layout of data for
  6. >the new (RISCOS3) text areas - the ones which can have a bit set to allow
  7. >kerning?
  8.  
  9. The objects are type 12 instead of type 1 and are identical with the
  10. addition of a 28 byte header: 6 words for a transformation matrix and
  11. a word for the flags.  Bit 0 of the flags is for kerning and bit 1 is
  12. for reversed direction.
  13.  
  14. Below is an example program which can convert text objects in draw files
  15. into kerned text objects.  I believe someone sells a similar program (with
  16. a wimp interface) for 10 pounds.
  17.  
  18. Andrew.
  19.  
  20. REM > DrawText
  21. REM ARB 12/11/93
  22. REM Modify text objects in draw file to be kerned
  23.  
  24. FileIn$="$.Drawfile"
  25. FileOut$="$.Output"
  26.  
  27. F%=OPENIN(FileIn$)
  28. IF F%=0 ERROR 0,"Cannot open file "+FileIn$
  29. FileSize%=EXT#F%
  30. CLOSE#F%
  31.  
  32. F%=OPENOUT(FileOut$)
  33. IF F%=0 ERROR 0,"Cannot create file "+FileOut$
  34.  
  35. DIM block% FileSize%         : REM loaded file
  36. DIM header% 28               : REM fake transformed text header
  37.  
  38. header%!0 = &10000
  39. header%!4 = 0
  40. header%!8 = 0
  41. header%!12 = &10000
  42. header%!16 = 0
  43. header%!20 = 0
  44. header%!24 = 1 : REM flags = kerned
  45.  
  46. OSCLI"Load "+FileIn$+" "+STR$~block%
  47.  
  48. REM skip file header
  49. offset% = 0
  50. PROCout(F%,block%,40)
  51. offset% = 40
  52.  
  53. WHILE offset% < FileSize%
  54.   ptr% = block%+offset%
  55.   type% = !ptr%
  56.   size% = ptr%!4
  57.   IF type%=1 THEN
  58.     !ptr% = 12
  59.     ptr%!4 = ptr%!4 + 28
  60.     PROCout(F%,ptr%,24) : REM updated object header
  61.     PROCout(F%,header%,28) : REM transformed text header
  62.     PROCout(F%,ptr%+24,size%-24) : REM rest of object
  63.   ELSE
  64.     IF type%=12 THEN ptr%!48 = ptr%!48 OR 1
  65.     PROCout(F%,ptr%,size%)
  66.   ENDIF
  67.   offset% += size%
  68. ENDWHILE
  69.  
  70. CLOSE#F%
  71. OSCLI"SetType "+FileOut$+" Drawfile"
  72. END
  73.  
  74. DEF PROCout(fd%,addr%,len%)
  75. SYS "OS_GBPB",2,fd%,addr%,len%
  76. ENDPROC
  77.  
  78.  
  79.