Skip to content

Commit

Permalink
completed text sample
Browse files Browse the repository at this point in the history
  • Loading branch information
galkahana committed Feb 27, 2011
1 parent 1e2111f commit 9f4235a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
Binary file modified UsingText/Materials/UsingText.pdf
Binary file not shown.
73 changes: 69 additions & 4 deletions UsingText/UsingText.cpp
Expand Up @@ -40,20 +40,85 @@ int main(int argc, wchar_t* argv[])
break;
}

pageContentContext->BT();
pageContentContext->k(0,0,0,1);

pageContentContext->BT();
pageContentContext->Tf(arialTTF,1);
pageContentContext->Tm(20,0,0,20,40,822);
pageContentContext->Tj(L"Text placed and scaled with Tm");
pageContentContext->ET();

pageContentContext->BT();
pageContentContext->Tf(arialTTF,20);
pageContentContext->Tm(1,0,0,1,90,610);
pageContentContext->Tj(L"San Antonio Pass, Cordillera Huayhuash, Peru");
pageContentContext->TD(40,800);
pageContentContext->Tj(L"Text placed with TD and scaled with Tf size parameter");
pageContentContext->ET();

// text with width control

pageContentContext->BT();
pageContentContext->Tf(arialTTF,20);
pageContentContext->Tm(1,0,0,1,40,700);

WStringOrDoubleList stringsAndWidthsA;
stringsAndWidthsA.push_back(WStringOrDouble(L"AWAY sample with no spacing"));
pageContentContext->TJ(stringsAndWidthsA);

pageContentContext->Tm(1,0,0,1,40,678);

WStringOrDoubleList stringsAndWidthsB;
//(A) 120 (W) 120 (A) 95 (Y again)
stringsAndWidthsB.push_back(WStringOrDouble(L"A"));
stringsAndWidthsB.push_back(WStringOrDouble(120));
stringsAndWidthsB.push_back(WStringOrDouble(L"W"));
stringsAndWidthsB.push_back(WStringOrDouble(120));
stringsAndWidthsB.push_back(WStringOrDouble(L"A"));
stringsAndWidthsB.push_back(WStringOrDouble(95));
stringsAndWidthsB.push_back(WStringOrDouble(L"Y sample with spacing"));
pageContentContext->TJ(stringsAndWidthsB);
pageContentContext->ET();

// multline text with leading control
pageContentContext->q();
pageContentContext->BT();

pageContentContext->Tm(1,0,0,1,40,600);
pageContentContext->TL(24);
pageContentContext->Tj(L"Some");
pageContentContext->Quote(L"Multiline");
pageContentContext->Quote(L"Text");

pageContentContext->Tm(1,0,0,1,40,500);
pageContentContext->TL(40);
pageContentContext->Tj(L"Some");
pageContentContext->Quote(L"More Multiline");
pageContentContext->Quote(L"Text");

pageContentContext->ET();
pageContentContext->Q();

// some text rendering sample
pageContentContext->q();
pageContentContext->BT();

pageContentContext->Tm(1,0,0,1,40,400);
pageContentContext->Tr(1);
pageContentContext->Tj(L"Text with 1 rendering mode");

pageContentContext->ET();
pageContentContext->Q();

// diect glyph placement
pageContentContext->BT();

pageContentContext->Tm(1,0,0,1,40,300);
pageContentContext->Tj(L"Text With Direct Glyph Placement: ");

GlyphUnicodeMappingList glyphs;
glyphs.push_back(GlyphUnicodeMapping(61,'Z'));

pageContentContext->Tj(glyphs);

pageContentContext->ET();

// End content context, and write the page
status = pdfWriter.EndPageContentContext(pageContentContext);
Expand Down

0 comments on commit 9f4235a

Please sign in to comment.