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


C++ FTPoint::Z方法代码示例

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


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

示例1: testKerning

        void testKerning()
        {
            FTFace test(ARIAL_FONT_FILE);
            FTPoint kerningVector = test.KernAdvance('A', 'A');
            CPPUNIT_ASSERT_EQUAL(kerningVector.X(), 0.);
            CPPUNIT_ASSERT_EQUAL(kerningVector.Y(), 0.);
            CPPUNIT_ASSERT_EQUAL(kerningVector.Z(), 0.);

            kerningVector = test.KernAdvance(0x6FB3, 0x9580);
            CPPUNIT_ASSERT_EQUAL(kerningVector.X(), 0.);
            CPPUNIT_ASSERT_EQUAL(kerningVector.Y(), 0.);
            CPPUNIT_ASSERT_EQUAL(kerningVector.Z(), 0.);
        }
开发者ID:pjohalloran,项目名称:gameframework,代码行数:13,代码来源:FTFace-Test.cpp

示例2: testSetters

        void testSetters()
        {
            FTPoint point;
            FTPoint point1(1, 2, 3);

            point.X(1);
            point.Y(2);
            point.Z(3);

            CPPUNIT_ASSERT(point == point1);
        }
开发者ID:pjohalloran,项目名称:gameframework,代码行数:11,代码来源:FTPoint-Test.cpp

示例3: WrapTextI

inline void FTSimpleLayoutImpl::WrapTextI(const T *buf, const int len,
                                          FTPoint position, int renderMode,
                                          FTBBox *bounds)
{
    FTUnicodeStringItr<T> breakItr(buf);          // points to the last break character
    FTUnicodeStringItr<T> lineStart(buf);         // points to the line start
    float nextStart = 0.0;     // total width of the current line
    float breakWidth = 0.0;    // width of the line up to the last word break
    float currentWidth = 0.0;  // width of all characters on the current line
    float prevWidth;           // width of all characters but the current glyph
    float wordLength = 0.0;    // length of the block since the last break char
    int charCount = 0;         // number of characters so far on the line
    int breakCharCount = 0;    // number of characters before the breakItr
    float glyphWidth, advance;
    FTBBox glyphBounds;
	bool refresh = false;
	
    // Reset the pen position
    pen.Y(0);
	
    // If we have bounds mark them invalid
    if(bounds)
    {
		bounds->Invalidate();
    }
	//XLOGXN("FTGL1");
	// Check if the incoming string is different to the previously
	// cached string.
	unsigned int i = 0;
	for (FTUnicodeStringItr<T> itr(buf); *itr; itr++)
	{
		XBREAK(i >= 4096);
		if (i >= stringCacheCount ||
			stringCache[i++] != (unsigned int)*itr)
		{
			refresh = true;
			break;
		}
	}
	
	//XLOGXN("FTGL2");
	if (refresh)
	{
		//XLOGXN("FTGL3");
		stringCacheCount = 0;
        layoutGlyphCache.clear();
		
		// Scan the input for all characters that need output
		FTUnicodeStringItr<T> prevItr(buf);
		for (FTUnicodeStringItr<T> itr(buf); *itr; prevItr = itr++, charCount++)
		{
			XBREAK(stringCacheCount >= 4096);
			stringCache[stringCacheCount++] = (unsigned int)*itr;
			
			// Find the width of the current glyph
			glyphBounds = currentFont->BBox(itr.getBufferFromHere(), 1);
			glyphWidth = glyphBounds.Upper().Xf() - glyphBounds.Lower().Xf();
			
			advance = currentFont->Advance(itr.getBufferFromHere(), 1);
			prevWidth = currentWidth;
			// Compute the width of all glyphs up to the end of buf[i]
			currentWidth = nextStart + glyphWidth;
			// Compute the position of the next glyph
			nextStart += advance;
			
			// See if the current character is a space, a break or a regular character
			if((currentWidth > lineLength) || (*itr == '\n'))
			{
				// A non whitespace character has exceeded the line length.  Or a
				// newline character has forced a line break.  Output the last
				// line and start a new line after the break character.
				// If we have not yet found a break, break on the last character
				if(breakItr == lineStart || (*itr == '\n'))
				{
					// Break on the previous character
					breakItr = prevItr;
					breakCharCount = charCount - 1;
					breakWidth = prevWidth;
					// None of the previous words will be carried to the next line
					wordLength = 0;
					// If the current character is a newline discard its advance
					if(*itr == '\n') advance = 0;
				}
				
				float remainingWidth = lineLength - breakWidth;
				
				// Render the current substring
				FTUnicodeStringItr<T> breakChar = breakItr;
				// move past the break character and don't count it on the next line either
				++breakChar; --charCount;
				// If the break character is a newline do not render it
				if(*breakChar == '\n')
				{
					++breakChar; --charCount;
				}
				
				layoutGlyphCacheItem_t cacheItem;
				cacheItem.buf = (T*)lineStart.getBufferFromHere();
				cacheItem.charCount = breakCharCount;
				cacheItem.position = FTPoint(position.X(), position.Y(), position.Z());
//.........这里部分代码省略.........
开发者ID:xahgo,项目名称:tama,代码行数:101,代码来源:FTSimpleLayout.cpp


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