| 160 | } |
| 161 | |
| 162 | void PDFUtils::AppendFloat(float value, const std::shared_ptr<WriteStream>& stream) { |
| 163 | if (value == INFINITY) { |
| 164 | value = FLT_MAX; |
| 165 | } |
| 166 | if (value == -INFINITY) { |
| 167 | value = -FLT_MAX; |
| 168 | } |
| 169 | if (!std::isfinite(value)) { |
| 170 | value = 0.0f; // PDF does not support NaN, so we use 0.0f as a fallback. |
| 171 | } |
| 172 | auto result = std::to_string(value); |
| 173 | stream->write(result.data(), result.size()); |
| 174 | } |
| 175 | |
| 176 | void PDFUtils::AppendTransform(const Matrix& matrix, const std::shared_ptr<WriteStream>& stream) { |
| 177 | auto affine = MatrixToPDFAffine(matrix); |