mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Introduce IBlock and ILettersBlock interfaces (Round 2) (#1263)
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Common Crawl Tests / build (0008-0009) (push) Has been cancelled
Run Common Crawl Tests / build (0010-0011) (push) Has been cancelled
Run Common Crawl Tests / build (0012-0013) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Tag Release / tag_if_version_changed (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Common Crawl Tests / build (0008-0009) (push) Has been cancelled
Run Common Crawl Tests / build (0010-0011) (push) Has been cancelled
Run Common Crawl Tests / build (0012-0013) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Tag Release / tag_if_version_changed (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
* Code review changes - Keep the Bounds property on the image classes so this isn't a major breaking API change - Don't expose letters collection * Minor fix * Switch to using BoundingBox in the library --------- Co-authored-by: davmarksman <david@brokit.co.uk>
This commit is contained in:
@@ -31,10 +31,10 @@
|
||||
var point = new PdfPoint(leftX, topPageY);
|
||||
DateTimeStampPage(pdfBuilder, page, point, cm);
|
||||
var letters = page.AddText("Adobe Standard Font ZapfDingbats", 21, point, F2);
|
||||
var newY = topPageY - letters.Select(v => v.GlyphRectangle.Height).Max() * 1.2;
|
||||
var newY = topPageY - letters.Select(v => v.BoundingBox.Height).Max() * 1.2;
|
||||
point = new PdfPoint(leftX, newY);
|
||||
letters = page.AddText("Font Specific encoding in Black (octal) and Unicode in Blue (hex)", 10, point, F2);
|
||||
newY = newY - letters.Select(v => v.GlyphRectangle.Height).Max() * 3;
|
||||
newY = newY - letters.Select(v => v.BoundingBox.Height).Max() * 3;
|
||||
point = new PdfPoint(leftX, newY);
|
||||
var eachRowY = new List<double>();
|
||||
eachRowY.Add(newY); // First row
|
||||
@@ -216,10 +216,10 @@
|
||||
var point = new PdfPoint(leftX, topPageY);
|
||||
DateTimeStampPage(pdfBuilder, page, point, cm);
|
||||
var letters = page.AddText("Adobe Standard Font Symbol ", 21, point, F2);
|
||||
var newY = topPageY - letters.Select(v => v.GlyphRectangle.Height).Max() * 1.2;
|
||||
var newY = topPageY - letters.Select(v => v.BoundingBox.Height).Max() * 1.2;
|
||||
point = new PdfPoint(leftX, newY);
|
||||
letters = page.AddText("Font Specific encoding in Black (octal), Unicode in Blue (hex), Red only available using Unicode", 10, point, F2);
|
||||
newY = newY - letters.Select(v => v.GlyphRectangle.Height).Max() * 3;
|
||||
newY = newY - letters.Select(v => v.BoundingBox.Height).Max() * 3;
|
||||
|
||||
|
||||
|
||||
@@ -492,10 +492,10 @@
|
||||
var point = new PdfPoint(leftX, topPageY);
|
||||
DateTimeStampPage(pdfBuilder, page, point, cm);
|
||||
var letters = page.AddText("Adobe Standard Font " + fontName, 21, point, F2);
|
||||
var newY = topPageY - letters.Select(v => v.GlyphRectangle.Height).Max() * 1.2;
|
||||
var newY = topPageY - letters.Select(v => v.BoundingBox.Height).Max() * 1.2;
|
||||
point = new PdfPoint(leftX, newY);
|
||||
letters = page.AddText("Font Specific encoding in Black, Unicode in Blue, Red only available using Unicode", 10, point, F2);
|
||||
newY = newY - letters.Select(v => v.GlyphRectangle.Height).Max() * 3;
|
||||
newY = newY - letters.Select(v => v.BoundingBox.Height).Max() * 3;
|
||||
point = new PdfPoint(leftX, newY);
|
||||
|
||||
|
||||
@@ -799,10 +799,10 @@
|
||||
var labelPointSize = 5;
|
||||
var octalString = System.Convert.ToString((int)stringToAdd[0], 8).PadLeft(3, '0');
|
||||
var label = octalString;
|
||||
var codeMidPoint = point.X + letter[0].GlyphRectangle.Width / 2;
|
||||
var codeMidPoint = point.X + letter[0].BoundingBox.Width / 2;
|
||||
var ml = page.MeasureText(label, labelPointSize, point, fontLabel);
|
||||
var labelY = point.Y + ml.Max(v => v.GlyphRectangle.Height) * 0.1 + maxCharacterHeight;
|
||||
var xLabel = codeMidPoint - (ml.Sum(v => v.GlyphRectangle.Width) / 2);
|
||||
var labelY = point.Y + ml.Max(v => v.BoundingBox.Height) * 0.1 + maxCharacterHeight;
|
||||
var xLabel = codeMidPoint - (ml.Sum(v => v.BoundingBox.Width) / 2);
|
||||
var labelPoint = new PdfPoint(xLabel, labelY);
|
||||
page.AddText(label, labelPointSize, labelPoint, fontLabel);
|
||||
}
|
||||
@@ -812,10 +812,10 @@
|
||||
var labelPointSize = 3;
|
||||
var hexString = $"{(int)stringToAdd[0]:X}".PadLeft(4, '0');
|
||||
var label = "0x" + hexString;
|
||||
var codeMidPoint = point.X + letter[0].GlyphRectangle.Width / 2;
|
||||
var codeMidPoint = point.X + letter[0].BoundingBox.Width / 2;
|
||||
var ml = page.MeasureText(label, labelPointSize, point, fontLabel);
|
||||
var labelY = point.Y - ml.Max(v => v.GlyphRectangle.Height) * 2.5;
|
||||
var xLabel = codeMidPoint - (ml.Sum(v => v.GlyphRectangle.Width) / 2);
|
||||
var labelY = point.Y - ml.Max(v => v.BoundingBox.Height) * 2.5;
|
||||
var xLabel = codeMidPoint - (ml.Sum(v => v.BoundingBox.Width) / 2);
|
||||
var labelPoint = new PdfPoint(xLabel, labelY);
|
||||
page.AddText(label, labelPointSize, labelPoint, fontLabel);
|
||||
}
|
||||
@@ -829,8 +829,8 @@
|
||||
double inch = (page.PageSize.Width / 8.5);
|
||||
double cm = inch / 2.54;
|
||||
|
||||
var letterWidth = letter[0].GlyphRectangle.Width * 2;
|
||||
var letterHeight = letter[0].GlyphRectangle.Height * 2;
|
||||
var letterWidth = letter[0].BoundingBox.Width * 2;
|
||||
var letterHeight = letter[0].BoundingBox.Height * 2;
|
||||
|
||||
var newX = point.X + maxCharacterWidth * 1.1;
|
||||
var newY = point.Y;
|
||||
@@ -892,7 +892,7 @@
|
||||
double maxCharacterWidth;
|
||||
{
|
||||
var point = new PdfPoint(10, 10);
|
||||
var characterRectangles = unicodesCharacters.Select(v => page.MeasureText($"{v}", 12, point, font)[0].GlyphRectangle);
|
||||
var characterRectangles = unicodesCharacters.Select(v => page.MeasureText($"{v}", 12, point, font)[0].BoundingBox);
|
||||
maxCharacterHeight = characterRectangles.Max(v => v.Height);
|
||||
maxCharacterWidth = characterRectangles.Max(v => v.Height);
|
||||
}
|
||||
@@ -921,8 +921,8 @@
|
||||
{
|
||||
var mtUTC = page.MeasureText(stampTextUTC, fontSize, point, courierFont);
|
||||
var mtlocal = page.MeasureText(stampTextLocal, fontSize, point, courierFont);
|
||||
var widthUTC = mtUTC.Sum(v => v.GlyphRectangle.Width);
|
||||
var widthLocal = mtlocal.Sum(v => v.GlyphRectangle.Width);
|
||||
var widthUTC = mtUTC.Sum(v => v.BoundingBox.Width);
|
||||
var widthLocal = mtlocal.Sum(v => v.BoundingBox.Width);
|
||||
|
||||
indentFromLeft -= Math.Max(widthUTC, widthLocal);
|
||||
}
|
||||
@@ -930,7 +930,7 @@
|
||||
{
|
||||
point = new PdfPoint(indentFromLeft, point.Y);
|
||||
var letters = page.AddText(stampTextUTC, 7, point, courierFont);
|
||||
var maxHeight = letters.Max(v => v.GlyphRectangle.Height);
|
||||
var maxHeight = letters.Max(v => v.BoundingBox.Height);
|
||||
point = new PdfPoint(indentFromLeft, point.Y - maxHeight * 1.2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user