本文整理汇总了C++中PSFont::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ PSFont::Width方法的具体用法?C++ PSFont::Width怎么用?C++ PSFont::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSFont
的用法示例。
在下文中一共展示了PSFont::Width方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Natural
void StrBrowserGraphic::Natural (int& w, int& h) {
FullGraphic gs;
totalGS(gs);
PSFont* font = gs.GetFont();
w = _width - _width % font->Width("n");
h = _height - _height % font->Height();
}
示例2: RotatedIntersects
boolean TextGraphic::RotatedIntersects (BoxObj& userb, Graphic* gs) {
int beg, end, lineSize, nextBeg, ypos = 0;
const char* s = GetOriginal();
int size = strlen(s);
PSFont* f = gs->GetFont();
Coord x[4], tx[5];
Coord y[4], ty[5];
x[0] = x[1] = x[2] = x[3] = y[0] = y[1] = 0;
y[2] = y[3] = f->Height();
for (beg = 0; beg < size; beg = nextBeg) {
GetLine(s, size, beg, end, lineSize, nextBeg);
x[1] = x[2] = f->Width(&s[beg], lineSize) - 1;
transformList(x, y, 4, tx, ty, gs);
tx[4] = tx[0];
ty[4] = ty[0];
FillPolygonObj fp(tx, ty, 5);
if (fp.Intersects(userb)) {
return true;
}
y[0] -= _lineHt;
y[1] -= _lineHt;
y[2] -= _lineHt;
y[3] -= _lineHt;
}
return false;
}
示例3: intersects
boolean ULabel::intersects (BoxObj& userb, Graphic* gs) {
Transformer* t = gs->GetTransformer();
PSFont* f = gs->GetFont();
Coord xmax = f->Width(_string);
Coord ymax = f->Height();
Coord tx0, ty0, tx1, ty1;
if (t != nil && t->Rotated()) {
Coord x[4], tx[5];
Coord y[4], ty[5];
x[0] = x[3] = y[0] = y[1] = 0;
x[2] = x[1] = xmax;
y[2] = y[3] = ymax;
transformList(x, y, 4, tx, ty, gs);
tx[4] = tx[0];
ty[4] = ty[0];
FillPolygonObj fp (tx, ty, 5);
return fp.Intersects(userb);
} else if (t != nil) {
t->Transform(0, 0, tx0, ty0);
t->Transform(xmax, ymax, tx1, ty1);
BoxObj b1 (tx0, ty0, tx1, ty1);
return b1.Intersects(userb);
} else {
BoxObj b2 (0, 0, xmax, ymax);
return b2.Intersects(userb);
}
}
示例4: contains
boolean ULabel::contains (PointObj& po, Graphic* gs) {
PointObj pt (&po);
PSFont* f = gs->GetFont();
invTransform(pt._x, pt._y, gs);
BoxObj b (0, 0, f->Width(_string), f->Height());
return b.Contains(pt);
}
示例5: GetRowsCols
void StrBrowserGraphic::GetRowsCols (int& rows, int& cols) {
FullGraphic gs;
totalGS(gs);
PSFont* font = gs.GetFont();
rows = _height / font->Height();
cols = _width / font->Width("n");
rows = (rows == 0) ? 1 : rows;
cols = (cols == 0) ? 1 : cols;
}
示例6: UntransformedIntersects
boolean TextGraphic::UntransformedIntersects (BoxObj& userb, Graphic* gs) {
int beg, end, lineSize, nextBeg, ypos = 0;
const char* s = GetOriginal();
int size = strlen(s);
PSFont* f = gs->GetFont();
BoxObj box(0, 0, 0, f->Height());
for (beg = 0; beg < size; beg = nextBeg) {
GetLine(s, size, beg, end, lineSize, nextBeg);
box._right = f->Width(&s[beg], lineSize) - 1;
if (box.Intersects(userb)) {
return true;
}
box._top -= _lineHt;
box._bottom -= _lineHt;
}
return false;
}
示例7: getExtent
void ULabel::getExtent (
float& x0, float& y0, float& cx, float& cy, float& tol, Graphic* gs
) {
PSFont* f = gs->GetFont();
float width = f->Width(_string);
float height = f->Height();
if (gs->GetTransformer() == nil) {
x0 = 0;
y0 = 0;
cx = width / 2;
cy = height / 2;
} else {
transformRect(0, 0, width, height, x0, y0, cx, cy, gs);
cx = (cx + x0)/2;
cy = (cy + y0)/2;
}
tol = 0;
}
示例8: contains
boolean TextGraphic::contains (PointObj& po, Graphic* gs) {
PointObj pt (&po);
PSFont* f = gs->GetFont();
BoxObj box(0, 0, 0, f->Height());
int beg, end, lineSize, nextBeg, ypos = 0;
const char* s = GetOriginal();
int size = strlen(s);
invTransform(pt._x, pt._y, gs);
for (beg = 0; beg < size; beg = nextBeg) {
GetLine(s, size, beg, end, lineSize, nextBeg);
box._right = f->Width(&s[beg], lineSize) - 1;
if (box.Contains(pt)) {
return true;
}
box._top -= _lineHt;
box._bottom -= _lineHt;
}
return false;
}
示例9: TransformedIntersects
boolean TextGraphic::TransformedIntersects (BoxObj& userb, Graphic* gs) {
int beg, end, lineSize, nextBeg, ypos = 0;
const char* s = GetOriginal();
int size = strlen(s);
PSFont* f = gs->GetFont();
Coord l, b, r, t = f->Height();
Coord tl, tb, tr, tt;
l = b = r = 0;
for (beg = 0; beg < size; beg = nextBeg) {
GetLine(s, size, beg, end, lineSize, nextBeg);
r = f->Width(&s[beg], lineSize) - 1;
transform(l, b, tl, tb, gs);
transform(r, t, tr, tt, gs);
BoxObj box(tl, tb, tr, tt);
if (box.Intersects(userb)) {
return true;
}
b -= _lineHt;
t -= _lineHt;
}
return false;
}