本文整理汇总了C++中ps_output::put_string方法的典型用法代码示例。如果您正苦于以下问题:C++ ps_output::put_string方法的具体用法?C++ ps_output::put_string怎么用?C++ ps_output::put_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_output
的用法示例。
在下文中一共展示了ps_output::put_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush_sbuf
void ps_printer::flush_sbuf()
{
enum {
NONE,
RELATIVE_H,
RELATIVE_V,
RELATIVE_HV,
ABSOLUTE
} motion = NONE;
int space_flag = 0;
if (sbuf_len == 0)
return;
if (output_style != sbuf_style) {
set_style(sbuf_style);
output_style = sbuf_style;
}
int extra_space = 0;
if (output_hpos < 0 || output_vpos < 0)
motion = ABSOLUTE;
else {
if (output_hpos != sbuf_start_hpos)
motion = RELATIVE_H;
if (output_vpos != sbuf_vpos) {
if (motion != NONE)
motion = RELATIVE_HV;
else
motion = RELATIVE_V;
}
}
if (sbuf_space_code >= 0) {
int w = sbuf_style.f->get_width(space_glyph, sbuf_style.point_size);
if (w + sbuf_kern != sbuf_space_width) {
if (sbuf_space_code != output_space_code) {
set_space_code(sbuf_space_code);
output_space_code = sbuf_space_code;
}
space_flag = 1;
extra_space = sbuf_space_width - w - sbuf_kern;
if (sbuf_space_diff_count > sbuf_space_count/2)
extra_space++;
else if (sbuf_space_diff_count < -(sbuf_space_count/2))
extra_space--;
}
}
if (space_flag)
out.put_fix_number(extra_space);
if (sbuf_kern != 0)
out.put_fix_number(sbuf_kern);
out.put_string(sbuf, sbuf_len);
char command_array[] = {'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T'};
char sym[2];
sym[0] = command_array[motion*4 + space_flag + 2*(sbuf_kern != 0)];
sym[1] = '\0';
switch (motion) {
case NONE:
break;
case ABSOLUTE:
out.put_fix_number(sbuf_start_hpos)
.put_fix_number(sbuf_vpos);
break;
case RELATIVE_H:
out.put_fix_number(sbuf_start_hpos - output_hpos);
break;
case RELATIVE_V:
out.put_fix_number(sbuf_vpos - output_vpos);
break;
case RELATIVE_HV:
out.put_fix_number(sbuf_start_hpos - output_hpos)
.put_fix_number(sbuf_vpos - output_vpos);
break;
default:
assert(0);
}
out.put_symbol(sym);
output_hpos = sbuf_end_hpos;
output_vpos = sbuf_vpos;
sbuf_len = 0;
}