Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
169 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Drawing; | ||
using PdfCraft.API; | ||
using PdfCraft.Fonts; | ||
|
||
namespace PdfCraft.Contents.Text | ||
{ | ||
internal class TextStyle | ||
{ | ||
public TextAlignment Alignment { get; set; } | ||
|
||
public Color Color { get; set; } | ||
|
||
public bool Superscript { get; set; } | ||
|
||
public FontDefinition Font { get; set; } | ||
|
||
public TextStyle Clone() | ||
{ | ||
return new TextStyle | ||
{ | ||
Alignment = Alignment, | ||
Color = Color, | ||
Superscript = Superscript, | ||
Font = Font | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Tests/Concerning_the_API/Given_a_document/When_Superscript_is_used.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Drawing; | ||
using NUnit.Framework; | ||
using PdfCraft.API; | ||
using PdfCraft.Containers; | ||
using PdfCraft.Fonts; | ||
|
||
namespace Tests.Concerning_the_API.Given_a_document | ||
{ | ||
public class When_Superscript_is_used : BaseTest | ||
{ | ||
private TextBox _sut; | ||
private Document _document; | ||
private Page _page; | ||
|
||
public override void Arrange() | ||
{ | ||
_document = new Document(); | ||
_page = _document.AddPage(); | ||
_sut = _document.CreateTextBox(new Rectangle(33, 12, 155, 255)); | ||
|
||
_sut.SetFont(new FontProperties("Helvetica", 10)); | ||
|
||
_page.AddTextBox(_sut); | ||
} | ||
|
||
public override void Act() | ||
{ | ||
_sut.AddText("normal text"); | ||
_sut.SetSuperscriptOn(); | ||
_sut.AddText("superscripted text"); | ||
_sut.SetSuperscriptOff(); | ||
_sut.AddText(" normal text again"); | ||
} | ||
|
||
[Test] | ||
public void It_should_render_a_pdf() | ||
{ | ||
var test = new TestExecutor(this); | ||
|
||
test.Assert(() => | ||
{ | ||
var generatedBytes = _document.Generate(); | ||
//DumpToRandomFile(generatedBytes, "pdf"); | ||
var content = new ByteArrayByteContainer(generatedBytes); | ||
Assert.IsNotNull(content); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters