本文整理汇总了C++中GlyphBuffer::xOffsetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ GlyphBuffer::xOffsetAt方法的具体用法?C++ GlyphBuffer::xOffsetAt怎么用?C++ GlyphBuffer::xOffsetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlyphBuffer
的用法示例。
在下文中一共展示了GlyphBuffer::xOffsetAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FloatPoint
TEST(GlyphBufferTest, StoresVerticalOffsets) {
RefPtr<SimpleFontData> font1 = TestSimpleFontData::create();
RefPtr<SimpleFontData> font2 = TestSimpleFontData::create();
GlyphBuffer glyphBuffer;
EXPECT_FALSE(glyphBuffer.hasVerticalOffsets());
glyphBuffer.add(42, font1.get(), FloatPoint(10, 0));
glyphBuffer.add(43, font1.get(), FloatPoint(15, 0));
glyphBuffer.add(44, font2.get(), FloatPoint(12, 2));
EXPECT_FALSE(glyphBuffer.isEmpty());
EXPECT_TRUE(glyphBuffer.hasVerticalOffsets());
EXPECT_EQ(3u, glyphBuffer.size());
const float* offsets = glyphBuffer.offsets(0);
EXPECT_EQ(10, glyphBuffer.xOffsetAt(0));
EXPECT_EQ(0, glyphBuffer.yOffsetAt(0));
EXPECT_EQ(15, glyphBuffer.xOffsetAt(1));
EXPECT_EQ(0, glyphBuffer.yOffsetAt(1));
EXPECT_EQ(12, glyphBuffer.xOffsetAt(2));
EXPECT_EQ(2, glyphBuffer.yOffsetAt(2));
EXPECT_EQ(10, offsets[0]);
EXPECT_EQ(0, offsets[1]);
EXPECT_EQ(15, offsets[2]);
EXPECT_EQ(0, offsets[3]);
EXPECT_EQ(12, offsets[4]);
EXPECT_EQ(2, offsets[5]);
}
示例2:
TEST(GlyphBufferTest, ReverseForSimpleRTL) {
RefPtr<SimpleFontData> font1 = TestSimpleFontData::create();
RefPtr<SimpleFontData> font2 = TestSimpleFontData::create();
GlyphBuffer glyphBuffer;
glyphBuffer.add(42, font1.get(), 10);
glyphBuffer.add(43, font1.get(), 15);
glyphBuffer.add(44, font2.get(), 25);
EXPECT_FALSE(glyphBuffer.isEmpty());
EXPECT_EQ(3u, glyphBuffer.size());
glyphBuffer.reverseForSimpleRTL(30, 100);
EXPECT_FALSE(glyphBuffer.isEmpty());
EXPECT_EQ(3u, glyphBuffer.size());
EXPECT_EQ(44, glyphBuffer.glyphAt(0));
EXPECT_EQ(43, glyphBuffer.glyphAt(1));
EXPECT_EQ(42, glyphBuffer.glyphAt(2));
EXPECT_EQ(font2.get(), glyphBuffer.fontDataAt(0));
EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(1));
EXPECT_EQ(font1.get(), glyphBuffer.fontDataAt(2));
EXPECT_EQ(70, glyphBuffer.xOffsetAt(0));
EXPECT_EQ(75, glyphBuffer.xOffsetAt(1));
EXPECT_EQ(85, glyphBuffer.xOffsetAt(2));
}