当前位置: 首页>>代码示例>>C++>>正文


C++ Glyph类代码示例

本文整理汇总了C++中Glyph的典型用法代码示例。如果您正苦于以下问题:C++ Glyph类的具体用法?C++ Glyph怎么用?C++ Glyph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Glyph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getGlyphById

void ActivityDiagram::setGlyphHeight(int id, int height)
{
	Glyph *glyph = getGlyphById(id);
	if (glyph != NULL)
		glyph->setHeight(height);
	notify();
}
开发者ID:aiueoH,项目名称:POSDHW_2012Fall,代码行数:7,代码来源:ActivityDiagram.cpp

示例2: traceConicBezier

int traceConicBezier(FT_VECTOR_PARAMETER *control, FT_VECTOR_PARAMETER *to, void *obj)
{
	Glyph *glyph = reinterpret_cast<Glyph *>(obj);
	Affine &affine = glyph->affine();
	BezierPathLibart *path = static_cast<BezierPathLibart *>(glyph->modifiableBezierPath());

	int index = path->m_array.count();
	if(!(index > 0))
		return -1;

	path->m_array.resize(index + 1);
	ArtBpath *s = &path->m_array[index - 1];
	ArtBpath *e = &path->m_array[index];

	e->code = ART_CURVETO;

	Point c = affine.mapPoint(Point(control->x, control->y));
	Point p = affine.mapPoint(Point(to->x, to->y));
	e->x3 = p.x();
	e->y3 = p.y();

	path->m_array[index].x1 = c.x() - (c.x() - s->x3) / 3;
	path->m_array[index].y1 = c.y() - (c.y() - s->y3) / 3;
	path->m_array[index].x2 = c.x() + (e->x3 - c.x()) / 3;
	path->m_array[index].y2 = c.y() + (e->y3 - c.y()) / 3;

	return 0;
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:28,代码来源:GlyphTracerLibart.cpp

示例3: while

void Text::sizeChanged()
{
	textX = 0;
	ellipsisStop = String::Iterator();
	if (isHeightAuto())
		height = font->getLineHeight();
	if (isWidthAuto())
		width = font->getTextWidth(string);
	else {
		if ((flags & (ALIGN_RIGHT | ALIGN_CENTER | ELLIPSIS)) != 0) {
			int w = 0;
			String::Iterator i = string.start();
			int c = -1;
			while (w <= getWidth() && (c = i.getForward()) != -1)
				w += font->getGlyph(Font::getGlyphIndex(c)).getWidth();
			if ((flags & ELLIPSIS) != 0 && w > getWidth()) {
				Glyph ellipsis = font->getCharGlyph(CHAR_ELLIPSIS);
				ellipsisStop = i;
				while (w > width - ellipsis.getWidth() && (c = ellipsisStop.getBackward()) != -1)
					w -= font->getGlyph(Font::getGlyphIndex(c)).getWidth();
				if (c == -1)
					ellipsisStop = string.start();
				w += ellipsis.getWidth();
			}
			if (w < getWidth()) {
				if ((flags & ALIGN_RIGHT) != 0)
					textX = getWidth() - w;
				else if ((flags & ALIGN_CENTER) != 0)
					textX = (getWidth() - w) / 2;
			}
		}
	}
}
开发者ID:dimdimdimdim,项目名称:geenie-firmware,代码行数:33,代码来源:text.cpp

示例4: count

void TBScrollBox::request(Requisition& req) const {
    GlyphIndex n = count();
    TBScrollBoxImpl& sb = *impl_;
    if (sb.changed_) {
	Requisition r;
	const Requirement& rx = r.x_requirement();
	const Requirement& ry = r.y_requirement();
	Coord natural_width = 0.0;
	Coord natural_height = 0.0;
	for (GlyphIndex i = 0; i < n; i++) {
	    Glyph* g = component(i);
	    if (g != nil) {
		g->request(r);
		Coord r_width = rx.natural();
		if (r_width > natural_width) {
		    natural_width = r_width;
		}
		natural_height += ry.natural();
	    }
	}
	Requirement& box_x = sb.requisition_.x_requirement();
	box_x.natural(natural_width);
	box_x.stretch(fil);
	box_x.shrink(natural_width);
	box_x.alignment(0.0);

	Requirement& box_y = sb.requisition_.y_requirement();
	box_y.natural(natural_height);
	box_y.stretch(fil);
	box_y.shrink(natural_height);
	box_y.alignment(1.0);
	sb.changed_ = false;
    }
    req = sb.requisition_;
}
开发者ID:PNCG,项目名称:neuron,代码行数:35,代码来源:scrbox.cpp

示例5: if

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button)
{
    prevMousePos = mousePos;
    mousePos.set(x, y);

    VF.addInwardCircle(x, y, 600, 0.1f);
    VF.addClockwiseCircle(x, y, 260, 0.3f);

    if (mode == 1) {  // DRAG MODE
        if (words.size() > 0) {
//            words.back().moveTo(mousePos);
        }
    }
    else if (mode == 2) {  // SPRAY MODE
        if (prevMousePos.distance(mousePos) > 10) {
            float targetScale = ofMap(mousePos.distance(prevMousePos), 0, MAX(ofGetWidth(), ofGetHeight()), 10, 500);
            float targetRotation = RAD_TO_DEG * (atan2(prevMousePos.y - mousePos.y, prevMousePos.x - mousePos.x));

            // Add a new Glyph to the last Word.
            Glyph *glyph = new Glyph();
            glyph->setInitialCondition(mousePos, ofVec2f());
            glyph->setScale(targetScale);
            glyph->setRotation(targetRotation);
            glyph->addForce((mousePos - prevMousePos) * 0.5);
            words.back()->addGlyph(glyph);
        }
    }
}
开发者ID:imclab,项目名称:megaphone,代码行数:29,代码来源:testApp.cpp

示例6: full_allocate

void BoxImpl::full_allocate(AllocationInfo& info) {
    Canvas* c = info.canvas();
    GlyphIndex n = box_->count();
    Allocation* a = info.component_allocations();
    Requisition* r = new Requisition[n];
    GlyphIndex i;
    for (i = 0; i < n; i++) {
        Glyph* g = box_->component(i);
        if (g != nil) {
            g->request(r[i]);
        }
    }
    layout_->allocate(info.allocation(), n, r, a);
    delete [] r;

    Extension& box = info.extension();
    Extension child;
    for (i = 0; i < n; i++) {
        Glyph* g = box_->component(i);
        if (g != nil) {
            child.clear();
            g->allocate(c, a[i], child);
            box.merge(child);
        }
    }
}
开发者ID:PNCG,项目名称:neuron,代码行数:26,代码来源:box.cpp

示例7: computeVisibleGlyphs

int BitmapFont::computeVisibleGlyphs ( const std::string& str, int start, int end, float availableWidth ) {
    int index = start;
    float width = 0;
    Glyph* lastGlyph = NULL;
    if ( data->scaleX == 1 ) {
        for ( ; index < end; index++ ) {
            char ch = str[index];
            Glyph* g = data->getGlyph ( ch );
            if ( g != NULL ) {
                if ( lastGlyph != NULL ) width += lastGlyph->getKerning ( ch );
                lastGlyph = g;
                if ( width + g->xadvance > availableWidth ) break;
                width += g->xadvance;
            }
        }
    } else {
        float scaleX = this->data->scaleX;
        for ( ; index < end; index++ ) {
            char ch = str[index];
            Glyph* g = data->getGlyph ( ch );
            if ( g != NULL ) {
                if ( lastGlyph != NULL ) width += lastGlyph->getKerning ( ch ) * scaleX;
                lastGlyph = g;
                if ( width + g->xadvance * scaleX > availableWidth ) break;
                width += g->xadvance * scaleX;
            }
        }
    }
    return index - start;
}
开发者ID:ozires,项目名称:libgdx-cpp,代码行数:30,代码来源:BitmapFont.cpp

示例8: Glyph

void SuperGlyph::create(float _scale){
    limbs.clear();
    
    //  Make a new Glyph
    //
    Glyph *glyph = new Glyph();
    glyph->setScale(_scale);
    
    //  Transform it to Shapes
    //
    for (int i = 0; i < glyph->limbs().size(); i++){
        Shape newShape;
        newShape.makeFromLimb(i, *glyph);
        newShape.bDebug = &bDebug;
        limbs.push_back( newShape );
    }
    
    //  Make a path from the shapes
    //
    insidePath.clear();
    for (int i = 0; i < limbs.size(); i++){
        for (int j = 0; j < limbs[i].getVertices().size(); j++) {
            ofPoint vert = limbs[i].getVertices()[j];
            insidePath.addVertex( vert );
        }
    }
    insidePath.close();
    perimeter = insidePath.getPerimeter();
    
    this->set( insidePath.getBoundingBox() );
}
开发者ID:patriciogonzalezvivo,项目名称:megaphone,代码行数:31,代码来源:SuperGlyph.cpp

示例9: addGlyph

void ActivityDiagram::paste()
{
	//map<sample, clone>
	map<Glyph*, Glyph*> glyphMap;
	// 新增
	for (unsigned int i = 0; i < _copyGlyphs.size(); i++)
	{
		int id = _idCount;
		_idCount++;
		Glyph *glyphClone = addGlyph(id, _copyGlyphs[i]->getType(), _copyGlyphs[i]->getText());
		glyphClone->setWidth(_copyGlyphs[i]->getWidth());
		glyphClone->setHeight(_copyGlyphs[i]->getHeight());
		if (glyphClone->getType() == EDGE)
		{
			glyphClone->setWidth(glyphClone->getWidth() + DELTA_X);
			glyphClone->setHeight(glyphClone->getHeight() + DELTA_Y);
		}
		glyphClone->setX(_copyGlyphs[i]->getX() + DELTA_X);
		glyphClone->setY(_copyGlyphs[i]->getY() + DELTA_Y);
		glyphMap.insert(pair<Glyph*, Glyph*>(_copyGlyphs[i], glyphClone));
	}
	connectCopyGlyph(_copyGlyphs, glyphMap);

	notify();
}
开发者ID:aiueoH,项目名称:POSDHW_2012Fall,代码行数:25,代码来源:ActivityDiagram.cpp

示例10: computeVisibleGlyphs

int BitmapFont::computeVisibleGlyphs ( const std::string& str, unsigned int start, unsigned int end, float availableWidth ) {
    unsigned int index = start;
    float width = 0;
    Glyph* lastGlyph = NULL;
    if ( data->scaleX == 1 ) {
        for ( ; index < end; ) {
            Glyph* g = nullptr;            
            unsigned int ch = data->getGlyph ( str , index, g  );
            if ( g != NULL ) {
                if ( lastGlyph != NULL ) width += lastGlyph->getKerning ( ch );
                lastGlyph = g;
                if ( width + g->xadvance > availableWidth ) break;
                width += g->xadvance;
            }
        }
    } else {
        float scaleX = this->data->scaleX;
        for ( ; index < end; ) {
            Glyph* g = nullptr;            
            unsigned int ch = data->getGlyph ( str , index, g  );
            if ( g != NULL ) {
                if ( lastGlyph != NULL ) width += lastGlyph->getKerning ( ch ) * scaleX;
                lastGlyph = g;
                if ((width + g->xadvance * scaleX) - availableWidth > 0.000001f ) break;
                width += g->xadvance * scaleX;
            }
        }
    }
    return index - start;
}
开发者ID:MrGlamur,项目名称:libgdx-cpp,代码行数:30,代码来源:BitmapFont.cpp

示例11: getMetrics

/** Traces all glyphs of the current font and stores them in the cache. If caching is disabled, nothing happens.
 *  @param[in] includeCached if true, glyphs already cached are traced again
 *  @param[in] cb optional callback methods called by the tracer
 *  @return number of glyphs traced */
int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const {
	int count = 0;
	if (type() == MF && CACHE_PATH) {
		if (const FontMetrics *metrics = getMetrics()) {
			int fchar = metrics->firstChar();
			int lchar = metrics->lastChar();
			string gfname;
			Glyph glyph;
			if (createGF(gfname)) {
				_cache.read(name().c_str(), CACHE_PATH);
				double ds = getMetrics() ? getMetrics()->getDesignSize() : 1;
				GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb);
				tracer.setGlyph(glyph);
				for (int i=fchar; i <= lchar; i++) {
					if (includeCached || !_cache.getGlyph(i)) {
						glyph.clear();
						tracer.executeChar(i);
						glyph.closeOpenSubPaths();
						_cache.setGlyph(i, glyph);
						++count;
					}
				}
				_cache.write(CACHE_PATH);
			}
		}
	}
	return count;
}
开发者ID:texlive,项目名称:texlive-source,代码行数:32,代码来源:Font.cpp

示例12: component

void Deck::print(Printer* p, const Allocation& a) const {
    if (card_ >= 0 && card_ < count()) {
	Glyph* g = component(card_);
	if (g != nil) {
	    g->print(p, a);
	}
    }
}
开发者ID:neurodebian,项目名称:iv-hines,代码行数:8,代码来源:deck.cpp

示例13: print

void LayoutLayer::print(Printer* p, const Allocation& a) const {
    if (under_ != nil) {
	under_->print(p, a);
    }
    MonoGlyph::print(p, a);
    if (over_ != nil) {
	over_->print(p, a);
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:9,代码来源:layout.c

示例14: undraw

void LayoutLayer::undraw() {
    if (under_ != nil) {
	under_->undraw();
    }
    MonoGlyph::undraw();
    if (over_ != nil) {
	over_->undraw();
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:9,代码来源:layout.c

示例15: draw

void LayoutLayer::draw(Canvas* c, const Allocation& a) const {
    if (under_ != nil) {
	under_->draw(c, a);
    }
    MonoGlyph::draw(c, a);
    if (over_ != nil) {
	over_->draw(c, a);
    }
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:9,代码来源:layout.c


注:本文中的Glyph类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。