[613] | 1 | PSOLLU1 ;BHAM/RJS - LASER LABEL UTILITIES ;11/22/02
|
---|
| 2 | ;;7.0;OUTPATIENT PHARMACY;**120,141,161**;DEC 1997
|
---|
| 3 | ;
|
---|
| 4 | FONT(RLN,TEXT) ;
|
---|
| 5 | ;--------------------------------------------------------------------
|
---|
| 6 | ;VARIABLES:
|
---|
| 7 | ; INPUT:
|
---|
| 8 | ; REQUIRED: RLN - Relates to a value used to determine the max
|
---|
| 9 | ; line length.
|
---|
| 10 | ; TEXT - Can contain a string and the $L(TEXT) is used
|
---|
| 11 | ; to calculate the font size.
|
---|
| 12 | ; RETURN:
|
---|
| 13 | ; FONT - This is the calculated optimal font size.
|
---|
| 14 | ; F8, F9, F10 or F12 will be returned.
|
---|
| 15 | ;--------------------------------------------------------------------
|
---|
| 16 | D STRT(RLN,TEXT,"",.FONT) Q FONT
|
---|
| 17 | Q
|
---|
| 18 | ;
|
---|
| 19 | STRT(RLN,TEXT,LNTH,FONT) ;
|
---|
| 20 | ; The LETTER array contains all the number of character per inch
|
---|
| 21 | ; for the different font sizes that can be used.
|
---|
| 22 | N LN,LETTER,TXTIDX,SIZ,FNTIDX,LTTR,A
|
---|
| 23 | S LETTER(1)="22^16^14^13^10",LETTER("!")="40^32^28^25^21"
|
---|
| 24 | S LETTER(2)="22^16^14^13^10",LETTER("@")="11^8^7^7^5"
|
---|
| 25 | S LETTER(3)="22^16^14^13^10",LETTER("#")="19^16^14^12^10"
|
---|
| 26 | S LETTER(4)="22^16^14^13^10",LETTER("$")="20^18^16^14^12"
|
---|
| 27 | S LETTER(5)="22^16^14^13^10",LETTER("%")="14^13^11^10^8"
|
---|
| 28 | S LETTER(6)="22^16^14^13^10"
|
---|
| 29 | S LETTER(7)="22^16^14^13^10",LETTER("&")="22^16^14^12^10"
|
---|
| 30 | S LETTER(8)="22^16^14^13^10",LETTER("*")="30^23^20^18^15"
|
---|
| 31 | S LETTER(9)="22^16^14^13^10",LETTER("(")="32^27^24^21^18"
|
---|
| 32 | S LETTER(0)="22^16^14^13^10",LETTER(")")="32^27^24^21^18"
|
---|
| 33 | S LETTER($C(34))="30^27^24^21^18",LETTER("'")="45^40^36^32^27"
|
---|
| 34 | S LETTER("`")="30^27^24^21^18",LETTER("~")="18^15^13^12^10"
|
---|
| 35 | S LETTER(",")="40^32^28^25^21",LETTER("<")="18^15^13^12^10"
|
---|
| 36 | S LETTER(".")="35^27^24^21^18",LETTER(">")="18^15^13^12^10"
|
---|
| 37 | S LETTER(";")="40^32^28^25^21",LETTER(":")="40^32^28^25^21"
|
---|
| 38 | S LETTER("?")="22^16^14^12^10",LETTER("/")="40^32^28^25^21"
|
---|
| 39 | S LETTER("[")="40^32^28^25^21",LETTER("{")="35^26^23^21^17"
|
---|
| 40 | S LETTER("\")="40^32^28^25^21",LETTER("|")="42^34^30^27^23"
|
---|
| 41 | S LETTER("]")="40^32^28^25^21",LETTER("}")="35^26^23^21^17"
|
---|
| 42 | S LETTER("_")="20^15^14^12^10",LETTER("-")="30^27^24^21^18"
|
---|
| 43 | S LETTER("=")="20^15^14^12^10",LETTER("+")="22^18^16^14^12"
|
---|
| 44 | S LETTER(" ")="40^32^28^25^21"
|
---|
| 45 | S LETTER("a")="19^16^14^12^10",LETTER("A")="16^13^11^10^8"
|
---|
| 46 | S LETTER("b")="19^16^14^12^10",LETTER("B")="16^13^11^10^8"
|
---|
| 47 | S LETTER("c")="22^18^16^14^12",LETTER("C")="15^13^11^10^8"
|
---|
| 48 | S LETTER("d")="20^16^14^12^10",LETTER("D")="15^13^11^10^8"
|
---|
| 49 | S LETTER("e")="20^16^14^12^10",LETTER("E")="16^13^11^10^8"
|
---|
| 50 | S LETTER("f")="40^32^28^25^21",LETTER("F")="18^14^13^11^9"
|
---|
| 51 | S LETTER("g")="20^16^14^12^10",LETTER("G")="14^11^10^9^7"
|
---|
| 52 | S LETTER("h")="20^16^14^12^10",LETTER("H")="15^13^11^10^8"
|
---|
| 53 | S LETTER("i")="50^40^36^32^27",LETTER("I")="40^32^28^25^21"
|
---|
| 54 | S LETTER("j")="50^40^36^32^27",LETTER("J")="22^18^16^14^12"
|
---|
| 55 | S LETTER("k")="24^18^16^14^12",LETTER("K")="16^13^11^10^8"
|
---|
| 56 | S LETTER("l")="50^40^36^32^27",LETTER("L")="20^16^14^12^10"
|
---|
| 57 | S LETTER("m")="13^10^9^8^7",LETTER("M")="13^11^10^9^7"
|
---|
| 58 | S LETTER("n")="20^16^14^12^10",LETTER("N")="15^13^11^10^8"
|
---|
| 59 | S LETTER("o")="20^16^14^12^10",LETTER("O")="14^11^10^9^7"
|
---|
| 60 | S LETTER("p")="20^16^14^12^10",LETTER("P")="16^13^11^10^8"
|
---|
| 61 | S LETTER("q")="20^16^14^12^10",LETTER("Q")="14^11^10^9^7"
|
---|
| 62 | S LETTER("r")="35^32^28^25^21",LETTER("R")="15^13^11^10^8"
|
---|
| 63 | S LETTER("s")="22^18^16^14^12",LETTER("S")="16^13^11^10^8"
|
---|
| 64 | S LETTER("t")="40^32^28^25^21",LETTER("T")="18^14^13^11^9"
|
---|
| 65 | S LETTER("u")="20^16^14^12^10",LETTER("U")="15^13^11^10^8"
|
---|
| 66 | S LETTER("v")="23^18^16^14^12",LETTER("V")="16^13^11^10^8"
|
---|
| 67 | S LETTER("w")="14^12^11^9^8",LETTER("W")="11^9^8^7^6"
|
---|
| 68 | S LETTER("x")="23^18^16^14^12",LETTER("X")="16^13^11^10^8"
|
---|
| 69 | S LETTER("y")="23^18^16^14^12",LETTER("Y")="16^13^11^10^8"
|
---|
| 70 | S LETTER("z")="23^18^16^14^12",LETTER("Z")="18^14^13^11^9"
|
---|
| 71 | ;
|
---|
| 72 | ; The LN array contains the length in inches for the different
|
---|
| 73 | ; sections of the laser label.
|
---|
| 74 | S LN("RX#")=3.126
|
---|
| 75 | S LN("RXVAMC")=2.626
|
---|
| 76 | S LN("DRG")=3.376
|
---|
| 77 | S LN("SIG")=3.126
|
---|
| 78 | S LN("WRN")=1.99
|
---|
| 79 | S LN("ML")=2.376
|
---|
| 80 | S LN("ML2")=1.76
|
---|
| 81 | S LN("SEC2")=4.1876
|
---|
| 82 | S LN("SEC2X")=LN("SEC2")
|
---|
| 83 | S LN("SIG2")=LN("SEC2")
|
---|
| 84 | S LN("SEC2B")=LN("WRN")
|
---|
| 85 | S LN("FULL")=8.1876
|
---|
| 86 | ;
|
---|
| 87 | ; The LNTH array is used in calculating the length of the text
|
---|
| 88 | ; for each of the different font sizes.
|
---|
| 89 | S (LNTH(6),LNTH(8),LNTH(9),LNTH(10),LNTH(12))=""
|
---|
| 90 | ;
|
---|
| 91 | ; This section walks the TEXT string and extracts the each character
|
---|
| 92 | ; then uses the LETTER array to lookup the number of characters per
|
---|
| 93 | ; inch and calculates the length of the TEXT for each font.
|
---|
| 94 | F TXTIDX=1:1:$L(TEXT) D
|
---|
| 95 | .S LTTR=$E(TEXT,TXTIDX),A=$G(LETTER(LTTR),"18^16^14^12^10")
|
---|
| 96 | .S LNTH(6)=LNTH(6)+(1/$P(A,U))
|
---|
| 97 | .S LNTH(8)=LNTH(8)+(1/($P(A,U,2)))
|
---|
| 98 | .S LNTH(9)=LNTH(9)+(1/($P(A,U,3)))
|
---|
| 99 | .S LNTH(10)=LNTH(10)+(1/($P(A,U,4)))
|
---|
| 100 | .S LNTH(12)=LNTH(12)+(1/($P(A,U,5)))
|
---|
| 101 | ;
|
---|
| 102 | ; This section determines what would be the optimal font for the TEXT
|
---|
| 103 | I RLN="WRN" D Q
|
---|
| 104 | . I LNTH(12)<LN(RLN) S FONT="F12" Q
|
---|
| 105 | . I LNTH(10)<(LN(RLN)*2) S FONT="F10" Q
|
---|
| 106 | . I LNTH(9)<(LN(RLN)*2.5) S FONT="F9" Q
|
---|
| 107 | . I LNTH(8)<(LN(RLN)*2.6) S FONT="F8" Q
|
---|
| 108 | . S FONT="F6"
|
---|
| 109 | S FONT="F0"
|
---|
| 110 | I LNTH(8)<LN(RLN) S FONT="F8"
|
---|
| 111 | I LNTH(9)<LN(RLN) S FONT="F9"
|
---|
| 112 | I LNTH(10)<LN(RLN) S FONT="F10"
|
---|
| 113 | I LNTH(12)<LN(RLN) S FONT="F12"
|
---|
| 114 | Q
|
---|
| 115 | ADD ; Calculate the length and pad "_" to the end of TEXT for change of address
|
---|
| 116 | ; then return FONT and TEXT to calling program.
|
---|
| 117 | N NEEDED,CNT,DASH
|
---|
| 118 | S NEEDED=LN("SEC2X")-LNTH(10)
|
---|
| 119 | S CNT=NEEDED*12\1
|
---|
| 120 | S DASH="________________________________________________________________________________________________________________"
|
---|
| 121 | S TEXT2=TEXT_" "_$E(DASH,1,CNT)
|
---|
| 122 | S FONT="F10"
|
---|
| 123 | Q
|
---|