PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.21
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.21
1.10.25 1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 All 169 releases
← All changes | includes/Templates/Thermal/Thermal_Bounds.php +33 -0 1.10.3 → 1.10.21 View file →
@@ -147,8 +147,41 @@
147 147 */
148 148 public const COL_WIDTH_MAX = self::PAPER_WIDTH_MAX;
149 149
150 150 /**
151 + * Printable dots across 80 mm paper at 203 dpi.
152 + */
153 + public const DOTS_80MM = 576;
154 +
155 + /**
156 + * Printable dots across 58 mm paper at 203 dpi.
157 + */
158 + public const DOTS_58MM = 384;
159 +
160 + /**
161 + * Column count at or above which paper is treated as 80 mm.
162 + *
163 + * 58 mm rolls carry 32 columns; 80 mm rolls carry 42 or 48.
164 + */
165 + public const WIDE_PAPER_COLUMNS = 40;
166 +
167 + /**
168 + * The printable width of the roll, in dots.
169 + *
170 + * Templates size images in dots, but declare paper in character columns, so
171 + * every lane that puts an image on paper has to bridge the two. Shared here
172 + * because an image scaled against 576 dots on one lane and 384 on another is
173 + * the same divergence this whole table exists to prevent.
174 + *
175 + * @param int $columns The paper width in character columns.
176 + *
177 + * @return int The printable width in dots.
178 + */
179 + public static function paper_dots( int $columns ): int {
180 + return $columns >= self::WIDE_PAPER_COLUMNS ? self::DOTS_80MM : self::DOTS_58MM;
181 + }
182 +
183 + /**
151 184 * Clamp a value into one of the ranges above.
152 185 *
153 186 * Thermal_Markup_Parser already clamps every attribute on its way into the
154 187 * AST, so for parsed templates this is a no-op. It is here for ASTs built by