-
Notifications
You must be signed in to change notification settings - Fork 1
/
ScalableBitmappedFont.swift
74 lines (71 loc) · 2.34 KB
/
ScalableBitmappedFont.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// ScalableBitmappedFont.swift
//
//
// Created by chen on 2023/11/12.
//
import Foundation
/// The ^A command specifies the font to use in a text field. ^A designates the font for the current ^FD statement or field.
/// The font specified by ^A is used only once for that ^FD entry.
/// If a value for ^A is not specified again, the default ^CF font is used for the next ^FD entry.
///
/// # Scalable/Bitmapped Font
public struct ScalableBitmappedFont: ZPLCommandConvertible {
/// Font name
///
/// Values: A through Z, and 0 to 9
/// * Any font in the printer (downloaded, EPROM, stored fonts, fonts A through Z and 0 to 9).
///
/// - Important: This parameter is required. If omitted it defaults to the last value of the ^CF command.
public var font: Character
/// Field orientation
public var orientation: Orientation
/// Character Height (in dots)
///
/// **Scalable**
///
/// Values: 10 to 32000
///
/// Default: last accepted ^CF
///
/// **Bitmapped**
///
/// Values: multiples of height from 1 to 10 times the standard height, in increments of 1
///
/// Default: last accepted ^CF
public var height: Int
/// Width (in dots)
///
/// **Scalable**
///
/// Values: 10 to 32000
///
/// Default: last accepted ^CF
///
/// **Bitmapped**
///
/// Values: multiples of width from 1 to 10 times the standard width, in increments of 1
///
/// Default: last accepted ^CF
public var width: Int
public var command: String {
"^A\(font)\(orientation.rawValue),\(height),\(width)"
}
/// Scalable/Bitmapped Font.
///
/// - Parameters:
/// - font: Font name. A through Z, and 0 to 9.
/// - orientation: Field orientation.
/// - height: Character Height (in dots).
/// * Scalable: 10 to 32000.
/// * Bitmapped: Multiples of height from 1 to 10 times the standard height, in increments of 1
/// - width: Width (in dots).
/// * Scalable: 10 to 32000.
/// * Bitmapped: Multiples of width from 1 to 10 times the standard width, in increments of 1.
public init(font: Character, orientation: Orientation, height: Int, width: Int) {
self.font = font
self.orientation = orientation
self.height = height
self.width = width
}
}