mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-06-28 15:30:17 +08:00
Rebase
This commit is contained in:
parent
b2fa76a756
commit
6ccf41f36c
@ -12,7 +12,8 @@ namespace UglyToad.PdfPig.Tests.Tokens
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void NullDictionaryThrows()
|
public void NullDictionaryThrows()
|
||||||
{
|
{
|
||||||
Action action = () => new DictionaryToken(null);
|
IReadOnlyDictionary<NameToken, IToken> dictionary = null;
|
||||||
|
Action action = () => new DictionaryToken(dictionary);
|
||||||
|
|
||||||
Assert.Throws<ArgumentNullException>(action);
|
Assert.Throws<ArgumentNullException>(action);
|
||||||
}
|
}
|
||||||
|
@ -75,11 +75,10 @@
|
|||||||
var transformedPdfBounds = PerformantRectangleTransformer
|
var transformedPdfBounds = PerformantRectangleTransformer
|
||||||
.Transform(renderingMatrix, textMatrix, transformationMatrix, new PdfRectangle(0, 0, characterBoundingBox.Width, 0));
|
.Transform(renderingMatrix, textMatrix, transformationMatrix, new PdfRectangle(0, 0, characterBoundingBox.Width, 0));
|
||||||
|
|
||||||
|
Letter letter = null;
|
||||||
Letter letter = null;
|
if (Diacritics.IsInCombiningDiacriticRange(unicode) && currentOffset > 0 && letters.Count > 0)
|
||||||
if (Diacritics.IsInCombiningDiacriticRange(unicode) && bytes.CurrentOffset > 0 && letters.Count > 0)
|
{
|
||||||
{
|
var attachTo = letters[letters.Count - 1];
|
||||||
var attachTo = letters[letters.Count - 1];
|
|
||||||
|
|
||||||
if (attachTo.TextSequence == TextSequence
|
if (attachTo.TextSequence == TextSequence
|
||||||
&& Diacritics.TryCombineDiacriticWithPreviousLetter(unicode, attachTo.Value, out var newLetter))
|
&& Diacritics.TryCombineDiacriticWithPreviousLetter(unicode, attachTo.Value, out var newLetter))
|
||||||
@ -87,39 +86,41 @@
|
|||||||
// TODO: union of bounding boxes.
|
// TODO: union of bounding boxes.
|
||||||
letters.Remove(attachTo);
|
letters.Remove(attachTo);
|
||||||
|
|
||||||
letter = new Letter(
|
|
||||||
newLetter,
|
|
||||||
attachTo.GlyphRectangle,
|
|
||||||
attachTo.StartBaseLine,
|
|
||||||
attachTo.EndBaseLine,
|
|
||||||
attachTo.Width,
|
|
||||||
attachTo.FontSize,
|
|
||||||
attachTo.Font,
|
|
||||||
attachTo.RenderingMode,
|
|
||||||
attachTo.StrokeColor,
|
|
||||||
attachTo.FillColor,
|
|
||||||
attachTo.PointSize,
|
|
||||||
attachTo.TextSequence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we did not create a letter for a combined diacritic, create one here.
|
|
||||||
if (letter == null)
|
|
||||||
{
|
|
||||||
letter = new Letter(
|
letter = new Letter(
|
||||||
unicode,
|
newLetter,
|
||||||
transformedGlyphBounds,
|
attachTo.GlyphRectangle,
|
||||||
transformedPdfBounds.BottomLeft,
|
attachTo.StartBaseLine,
|
||||||
transformedPdfBounds.BottomRight,
|
attachTo.EndBaseLine,
|
||||||
transformedPdfBounds.Width,
|
attachTo.Width,
|
||||||
fontSize,
|
attachTo.FontSize,
|
||||||
font.Details,
|
attachTo.Font,
|
||||||
currentState.FontState.TextRenderingMode,
|
attachTo.RenderingMode,
|
||||||
currentState.CurrentStrokingColor,
|
attachTo.StrokeColor,
|
||||||
currentState.CurrentNonStrokingColor,
|
attachTo.FillColor,
|
||||||
pointSize,
|
attachTo.PointSize,
|
||||||
textSequence);
|
attachTo.TextSequence);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentState = GetCurrentState(); // TODO - pass stroking and text rendering mode
|
||||||
|
|
||||||
|
// If we did not create a letter for a combined diacritic, create one here.
|
||||||
|
if (letter == null)
|
||||||
|
{
|
||||||
|
letter = new Letter(
|
||||||
|
unicode,
|
||||||
|
transformedGlyphBounds,
|
||||||
|
transformedPdfBounds.BottomLeft,
|
||||||
|
transformedPdfBounds.BottomRight,
|
||||||
|
transformedPdfBounds.Width,
|
||||||
|
fontSize,
|
||||||
|
font.Details,
|
||||||
|
currentState.FontState.TextRenderingMode,
|
||||||
|
currentState.CurrentStrokingColor,
|
||||||
|
currentState.CurrentNonStrokingColor,
|
||||||
|
pointSize,
|
||||||
|
TextSequence);
|
||||||
|
}
|
||||||
|
|
||||||
letters.Add(letter);
|
letters.Add(letter);
|
||||||
markedContentStack.AddLetter(letter);
|
markedContentStack.AddLetter(letter);
|
||||||
|
Loading…
Reference in New Issue
Block a user