70int32_t CBC_OnedUPCAWriter::
CalcChecksum(
const ByteString& contents) {
74 for (size_t i = contents.GetLength(); i > 0; i--) {
76 odd += FXSYS_DecimalCharToInt(contents[i - 1]);
78 even += FXSYS_DecimalCharToInt(contents[i - 1]);
82 int32_t checksum = (odd * 3 + even) % 10;
83 checksum = (10 - checksum) % 10;
93bool CBC_OnedUPCAWriter::
ShowChars(WideStringView contents,
100 constexpr float kLeftPosition = 17.0f;
101 ByteString str = FX_UTF8Encode(contents);
102 size_t length = str.GetLength();
103 std::vector<TextCharPos> charpos(length);
104 ByteString tempStr = str.Substr(1, 5);
105 constexpr float kWidth = 35.0f;
108 length = tempStr.GetLength();
109 int32_t iFontSize =
static_cast<int32_t>(fabs(
m_fFontSize));
110 int32_t iTextHeight = iFontSize + 1;
114 kLeftPosition + kWidth - 0.5
, (
float)
m_Height);
120 kLeftPosition + 40 + kWidth - 0.5
, (
float)
m_Height);
124 constexpr float kWidth1 = 7.0f;
133 kLeftPosition + 85 + kWidth1 - 0.5
, (
float)
m_Height);
139 CalcTextInfo(tempStr, &charpos[1], m_pFont, strWidth, iFontSize, blank);
143 (
float)(
m_Height - iTextHeight + iFontSize)
);
145 device->DrawNormalText(pdfium::make_span(charpos).subspan(1, length),
146 m_pFont,
static_cast<
float>(iFontSize),
147 affine_matrix1, m_fontColor, GetTextRenderOptions());
149 tempStr = str.Substr(6, 5);
150 length = tempStr.GetLength();
151 CalcTextInfo(tempStr, &charpos[6], m_pFont, strWidth, iFontSize, blank);
155 (
float)(
m_Height - iTextHeight + iFontSize)
);
157 device->DrawNormalText(pdfium::make_span(charpos).subspan(6, length),
158 m_pFont,
static_cast<
float>(iFontSize),
159 affine_matrix1, m_fontColor, GetTextRenderOptions());
161 tempStr = str.First(1);
162 length = tempStr.GetLength();
165 CalcTextInfo(tempStr, charpos.data(), m_pFont, strWidth, iFontSize, blank);
168 (
float)(
m_Height - iTextHeight + iFontSize)
);
170 device->DrawNormalText(pdfium::make_span(charpos).first(length), m_pFont,
171 static_cast<
float>(iFontSize), affine_matrix1,
172 m_fontColor, GetTextRenderOptions());
174 tempStr = str.Substr(11, 1);
175 length = tempStr.GetLength();
176 CalcTextInfo(tempStr, &charpos[11], m_pFont, strWidth, iFontSize, blank);
180 (
float)(
m_Height - iTextHeight + iFontSize)
);
182 device->DrawNormalText(pdfium::make_span(charpos).subspan(11, length),
183 m_pFont,
static_cast<
float>(iFontSize),
184 affine_matrix1, m_fontColor, GetTextRenderOptions());