5#include "core/fxge/win32/ctext_only_printer_driver.h"
12#include "core/fxcrt/check_op.h"
13#include "core/fxcrt/compiler_specific.h"
14#include "core/fxcrt/fx_memcpy_wrappers.h"
15#include "core/fxcrt/fx_string.h"
16#include "core/fxcrt/fx_system.h"
17#include "core/fxcrt/notreached.h"
18#include "core/fxge/agg/cfx_agg_imagerenderer.h"
19#include "core/fxge/cfx_font.h"
20#include "core/fxge/dib/cfx_dibbase.h"
21#include "core/fxge/dib/cfx_dibitmap.h"
22#include "core/fxge/text_char_pos.h"
32 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL);
38 return DeviceType::kPrinter;
48 return m_nBitsPerPixel;
83 uint32_t stroke_color,
120 return {Result::kNotSupported,
nullptr};
124 pdfium::span<
const TextCharPos> pCharPos,
133 if (pCharPos.empty() || !pFont) {
139 const double kScaleFactor = 10;
146 size_t len = pCharPos.size();
147 float fOffsetY = mtObject2Device
.f * kScaleFactor;
153 m_OriginY = fOffsetY;
157 for (
const auto& charpos : pCharPos) {
165 wsText += charpos.m_Unicode;
168 auto text_span = text.span();
169 while (!text_span.empty()) {
170 uint8_t buffer[1026];
171 size_t send_len = std::min<size_t>(text_span.size(), 1024);
172 *(
reinterpret_cast<uint16_t*>(buffer)) =
static_cast<uint16_t>(send_len);
173 UNSAFE_TODO(FXSYS_memcpy(buffer + 2, text_span.data(), send_len));
174 ::GdiComment(m_hDC,
static_cast<UINT>(send_len + 2), buffer);
175 text_span = text_span.subspan(send_len);
fxcrt::ByteString ByteString
WindowsPrintMode g_pdfium_print_mode
DeviceType GetDeviceType() const override
~CTextOnlyPrinterDriver() override
bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options) override
bool DrawDeviceText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color, const CFX_TextRenderOptions &options) override
void RestoreState(bool bKeepSaved) override
bool MultiplyAlpha(float alpha) override
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState) override
void SaveState() override
StartResult StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, BlendMode blend_type) override
int GetDeviceCaps(int caps_id) const override
CTextOnlyPrinterDriver(HDC hDC)
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT *pClipRect, const FXDIB_ResampleOptions &options, BlendMode blend_type) override
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options) override
FX_RECT GetClipBox() const override
bool MultiplyAlphaMask(RetainPtr< const CFX_DIBitmap > mask) override
bool SetDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, const FX_RECT &src_rect, int left, int top, BlendMode blend_type) override
WideString & operator+=(const wchar_t *str)
ByteString ToDefANSI() const
int FXSYS_roundf(float f)
#define NOTREACHED_NORETURN()
#define FXDC_PIXEL_HEIGHT
constexpr FX_RECT(int l, int t, int r, int b)
fxcrt::WideString WideString