5#include "core/fxge/win32/ctext_only_printer_driver.h"
14#include "core/fxcrt/fx_string.h"
15#include "core/fxcrt/fx_system.h"
16#include "core/fxge/cfx_font.h"
17#include "core/fxge/dib/cfx_dibbase.h"
18#include "core/fxge/text_char_pos.h"
19#include "third_party/base/check_op.h"
20#include "third_party/base/notreached.h"
30 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL);
46 return m_nBitsPerPixel;
54 NOTREACHED_NORETURN();
80 uint32_t stroke_color,
122 std::unique_ptr<CFX_ImageRenderer>* handle,
141 const double kScaleFactor = 10;
148 size_t len = pCharPos.size();
149 float fOffsetY = mtObject2Device
.f * kScaleFactor;
155 m_OriginY = fOffsetY;
159 for (
const auto& charpos : pCharPos) {
162 DCHECK_EQ(charpos.m_AdjustMatrix[0], 0);
163 DCHECK_EQ(charpos.m_AdjustMatrix[1], 0);
164 DCHECK_EQ(charpos.m_AdjustMatrix[2], 0);
165 DCHECK_EQ(charpos.m_AdjustMatrix[3], 0);
166 DCHECK_EQ(charpos.m_Origin.y, 0);
167 wsText += charpos.m_Unicode;
170 auto text_span = text.span();
171 while (!text_span.empty()) {
172 uint8_t buffer[1026];
173 size_t send_len = std::min<size_t>(text_span.size(), 1024);
174 *(
reinterpret_cast<uint16_t*>(buffer)) =
static_cast<uint16_t>(send_len);
175 memcpy(buffer + 2, text_span.data(), send_len);
176 ::GdiComment(m_hDC,
static_cast<UINT>(send_len + 2), buffer);
177 text_span = text_span.subspan(send_len);
185 NOTREACHED_NORETURN();
192 NOTREACHED_NORETURN();
WindowsPrintMode g_pdfium_print_mode
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t color, const FX_RECT &src_rect, int left, int top, BlendMode blend_type) override
DeviceType GetDeviceType() const override
~CTextOnlyPrinterDriver() override
bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options) 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, BlendMode blend_type) 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
bool MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask) override
void SaveState() 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 StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_type) override
bool GetClipBox(FX_RECT *pRect) override
WideString & operator+=(const wchar_t *str)
ByteString ToDefANSI() const
int FXSYS_roundf(float f)
#define FXDC_PIXEL_HEIGHT