From 4f898837f91261228eddeb25c49a4b1ea7c7fbdc Mon Sep 17 00:00:00 2001 From: jmeaster30 Date: Sun, 22 Oct 2023 21:55:55 -0400 Subject: [PATCH] Removed BlastSharp and started working on CompactFontFormatTable --- BlastPDF.Test/Filters/Ascii85Tests.cs | 205 ----------------- BlastPDF.Test/Filters/AsciiHexTests.cs | 187 ---------------- BlastPDF.Test/Filters/FilterTestHelpers.cs | 20 -- BlastPDF.Test/Filters/LzwTests.cs | 188 ---------------- BlastPDF.Test/Filters/RunLengthTests.cs | 187 ---------------- BlastPDF.sln | 14 -- BlastPDF/BlastPDF.csproj | 3 +- BlastPDF/Builder/PdfValue.cs | 1 - BlastPDF/Builder/Util.cs | 27 +++ BlastPDF/Exporter/Basic/BasicExporter.cs | 3 +- BlastPDF/Filter/Implementations/Ascii85.cs | 75 ------- BlastPDF/Filter/Implementations/AsciiHex.cs | 50 ----- BlastPDF/Filter/Implementations/Lzw.cs | 207 ------------------ BlastPDF/Filter/Implementations/PdfAscii85.cs | 30 +++ .../Filter/Implementations/PdfAsciiHex.cs | 26 +++ BlastPDF/Filter/Implementations/RunLength.cs | 89 -------- BlastPDF/Filter/PdfFilter.cs | 19 +- BlastSharp/Text/StringExtensions.cs | 2 +- BlastType/BlastFont.cs | 9 +- BlastType/BlastType.csproj | 9 +- .../ByteEncodingTable.cs | 2 +- .../ICharacterMapSubtable.cs | 2 +- .../MixedCoverageTable.cs | 2 +- .../CharacterMapSubtables/SegmentMapTable.cs | 2 +- .../TrimmedMappingTable.cs | 2 +- BlastType/Internal/CharacterMapTable.cs | 2 +- .../CompactFontFormatHeader.cs | 23 ++ BlastType/Internal/CompactFontFormatTable.cs | 19 +- BlastType/Internal/DataTypes/Fixed.cs | 2 +- BlastType/Internal/DigitalSignature.cs | 2 +- BlastType/Internal/EncodingRecord.cs | 2 +- BlastType/Internal/FontHeader.cs | 2 +- .../AttachmentPointListTable.cs | 3 +- .../ClassRangeRecord.cs | 2 +- .../GlyphClassDefinitionTable.cs | 3 +- BlastType/Internal/GlyphDefinitionTable.cs | 2 +- .../ScriptListTable.cs | 2 +- .../GlyphPositioningSubtables/ScriptRecord.cs | 2 +- BlastType/Internal/GlyphPositioningTable.cs | 2 +- BlastType/Internal/HorizontalHeader.cs | 2 +- BlastType/Internal/HorizontalMetrics.cs | 2 +- BlastType/Internal/LanguageRecord.cs | 2 +- BlastType/Internal/LongHorizontalMetric.cs | 2 +- BlastType/Internal/MaximumProfile.cs | 2 +- BlastType/Internal/NameRecord.cs | 2 +- BlastType/Internal/NameTable.cs | 2 +- BlastType/Internal/Os2.cs | 2 +- BlastType/Internal/PostTable.cs | 2 +- BlastType/Internal/SequentialMapGroup.cs | 2 +- BlastType/Internal/SubHeader.cs | 2 +- BlastType/Internal/TableRecord.cs | 2 +- ShowCase/PdfBuilderExample.cs | 3 +- ShowCase/Program.cs | 5 +- 53 files changed, 179 insertions(+), 1282 deletions(-) delete mode 100644 BlastPDF.Test/Filters/Ascii85Tests.cs delete mode 100644 BlastPDF.Test/Filters/AsciiHexTests.cs delete mode 100644 BlastPDF.Test/Filters/FilterTestHelpers.cs delete mode 100644 BlastPDF.Test/Filters/LzwTests.cs delete mode 100644 BlastPDF.Test/Filters/RunLengthTests.cs create mode 100644 BlastPDF/Builder/Util.cs delete mode 100644 BlastPDF/Filter/Implementations/Ascii85.cs delete mode 100644 BlastPDF/Filter/Implementations/AsciiHex.cs delete mode 100644 BlastPDF/Filter/Implementations/Lzw.cs create mode 100644 BlastPDF/Filter/Implementations/PdfAscii85.cs create mode 100644 BlastPDF/Filter/Implementations/PdfAsciiHex.cs delete mode 100644 BlastPDF/Filter/Implementations/RunLength.cs create mode 100644 BlastType/Internal/CompactFontFormatSubtables/CompactFontFormatHeader.cs diff --git a/BlastPDF.Test/Filters/Ascii85Tests.cs b/BlastPDF.Test/Filters/Ascii85Tests.cs deleted file mode 100644 index 10c861a..0000000 --- a/BlastPDF.Test/Filters/Ascii85Tests.cs +++ /dev/null @@ -1,205 +0,0 @@ -using BlastPDF.Filter; -using Xunit; - -namespace BlastPDF.Test.Filters; - -public class Ascii85Tests -{ - [Fact] - public void TestIDidIt() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, "i did it :)"); - } - - [Fact] - public void TestMustTestThis() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, "I must test this a bunch"); - } - - [Fact] - public void TestLeviathan() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."); - } - - [Fact] - public void Test1() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, "this is a test of the lzw filter"); - } - - [Fact] - public void Test2() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, "this?"); - } - - [Fact] - public void Test3() - { - FilterTestHelpers.TestFilter(PdfFilter.Ascii85, @" -Project Gutenberg's Frankenstein, by Mary Wollstonecraft (Godwin) Shelley - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - - -Title: Frankenstein - or The Modern Prometheus - -Author: Mary Wollstonecraft (Godwin) Shelley - -Release Date: June 17, 2008 [EBook #84] - -Language: English - - -*** START OF THIS PROJECT GUTENBERG EBOOK FRANKENSTEIN *** - - - - -Produced by Judith Boss, Christy Phillips, Lynn Hanninen, -and David Meltzer. HTML version by Al Haines. - - - - - - - - - - -Frankenstein, - -or the Modern Prometheus - - -by - -Mary Wollstonecraft (Godwin) Shelley - - - - -Letter 1 - - -St. Petersburgh, Dec. 11th, 17-- - -TO Mrs. Saville, England - -You will rejoice to hear that no disaster has accompanied the -commencement of an enterprise which you have regarded with such evil -forebodings. I arrived here yesterday, and my first task is to assure -my dear sister of my welfare and increasing confidence in the success -of my undertaking. - -I am already far north of London, and as I walk in the streets of -Petersburgh, I feel a cold northern breeze play upon my cheeks, which -braces my nerves and fills me with delight. Do you understand this -feeling? This breeze, which has travelled from the regions towards -which I am advancing, gives me a foretaste of those icy climes. -Inspirited by this wind of promise, my daydreams become more fervent -and vivid. I try in vain to be persuaded that the pole is the seat of -frost and desolation; it ever presents itself to my imagination as the -region of beauty and delight. There, Margaret, the sun is forever -visible, its broad disk just skirting the horizon and diffusing a -perpetual splendour. There--for with your leave, my sister, I will put -some trust in preceding navigators--there snow and frost are banished; -and, sailing over a calm sea, we may be wafted to a land surpassing in -wonders and in beauty every region hitherto discovered on the habitable -globe. Its productions and features may be without example, as the -phenomena of the heavenly bodies undoubtedly are in those undiscovered -solitudes. What may not be expected in a country of eternal light? I -may there discover the wondrous power which attracts the needle and may -regulate a thousand celestial observations that require only this -voyage to render their seeming eccentricities consistent forever. I -shall satiate my ardent curiosity with the sight of a part of the world -never before visited, and may tread a land never before imprinted by -the foot of man. These are my enticements, and they are sufficient to -conquer all fear of danger or death and to induce me to commence this -laborious voyage with the joy a child feels when he embarks in a little -boat, with his holiday mates, on an expedition of discovery up his -native river. But supposing all these conjectures to be false, you -cannot contest the inestimable benefit which I shall confer on all -mankind, to the last generation, by discovering a passage near the pole -to those countries, to reach which at present so many months are -requisite; or by ascertaining the secret of the magnet, which, if at -all possible, can only be effected by an undertaking such as mine. - -These reflections have dispelled the agitation with which I began my -letter, and I feel my heart glow with an enthusiasm which elevates me -to heaven, for nothing contributes so much to tranquillize the mind as -a steady purpose--a point on which the soul may fix its intellectual -eye. This expedition has been the favourite dream of my early years. I -have read with ardour the accounts of the various voyages which have -been made in the prospect of arriving at the North Pacific Ocean -through the seas which surround the pole. You may remember that a -history of all the voyages made for purposes of discovery composed the -whole of our good Uncle Thomas' library. My education was neglected, -yet I was passionately fond of reading. These volumes were my study -day and night, and my familiarity with them increased that regret which -I had felt, as a child, on learning that my father's dying injunction -had forbidden my uncle to allow me to embark in a seafaring life. - -These visions faded when I perused, for the first time, those poets -whose effusions entranced my soul and lifted it to heaven. I also -became a poet and for one year lived in a paradise of my own creation; -I imagined that I also might obtain a niche in the temple where the -names of Homer and Shakespeare are consecrated. You are well -acquainted with my failure and how heavily I bore the disappointment. -But just at that time I inherited the fortune of my cousin, and my -thoughts were turned into the channel of their earlier bent. - -Six years have passed since I resolved on my present undertaking. I -can, even now, remember the hour from which I dedicated myself to this -great enterprise. I commenced by inuring my body to hardship. I -accompanied the whale-fishers on several expeditions to the North Sea; -I voluntarily endured cold, famine, thirst, and want of sleep; I often -worked harder than the common sailors during the day and devoted my -nights to the study of mathematics, the theory of medicine, and those -branches of physical science from which a naval adventurer might derive -the greatest practical advantage. Twice I actually hired myself as an -under-mate in a Greenland whaler, and acquitted myself to admiration. I -must own I felt a little proud when my captain offered me the second -dignity in the vessel and entreated me to remain with the greatest -earnestness, so valuable did he consider my services. And now, dear -Margaret, do I not deserve to accomplish some great purpose? My life -might have been passed in ease and luxury, but I preferred glory to -every enticement that wealth placed in my path. Oh, that some -encouraging voice would answer in the affirmative! My courage and my -resolution is firm; but my hopes fluctuate, and my spirits are often -depressed. I am about to proceed on a long and difficult voyage, the -emergencies of which will demand all my fortitude: I am required not -only to raise the spirits of others, but sometimes to sustain my own, -when theirs are failing. - -This is the most favourable period for travelling in Russia. They fly -quickly over the snow in their sledges; the motion is pleasant, and, in -my opinion, far more agreeable than that of an English stagecoach. The -cold is not excessive, if you are wrapped in furs--a dress which I have -already adopted, for there is a great difference between walking the -deck and remaining seated motionless for hours, when no exercise -prevents the blood from actually freezing in your veins. I have no -ambition to lose my life on the post-road between St. Petersburgh and -Archangel. I shall depart for the latter town in a fortnight or three -weeks; and my intention is to hire a ship there, which can easily be -done by paying the insurance for the owner, and to engage as many -sailors as I think necessary among those who are accustomed to the -whale-fishing. I do not intend to sail until the month of June; and -when shall I return? Ah, dear sister, how can I answer this question? -If I succeed, many, many months, perhaps years, will pass before you -and I may meet. If I fail, you will see me again soon, or never. -Farewell, my dear, excellent Margaret. Heaven shower down blessings on -you, and save me, that I may again and again testify my gratitude for -all your love and kindness. - -Your affectionate brother, - R. Walton"); - } -} \ No newline at end of file diff --git a/BlastPDF.Test/Filters/AsciiHexTests.cs b/BlastPDF.Test/Filters/AsciiHexTests.cs deleted file mode 100644 index d7cb25e..0000000 --- a/BlastPDF.Test/Filters/AsciiHexTests.cs +++ /dev/null @@ -1,187 +0,0 @@ -using BlastPDF.Filter; -using Xunit; - -namespace BlastPDF.Test.Filters; - -public class AsciiHexTests -{ - [Fact] - public void Test1() - { - FilterTestHelpers.TestFilter(PdfFilter.AsciiHex, "this is a test of the lzw filter"); - } - - [Fact] - public void Test2() - { - FilterTestHelpers.TestFilter(PdfFilter.AsciiHex, "this?"); - } - - [Fact] - public void Test3() - { - FilterTestHelpers.TestFilter(PdfFilter.AsciiHex, @" -Project Gutenberg's Frankenstein, by Mary Wollstonecraft (Godwin) Shelley - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - - -Title: Frankenstein - or The Modern Prometheus - -Author: Mary Wollstonecraft (Godwin) Shelley - -Release Date: June 17, 2008 [EBook #84] - -Language: English - - -*** START OF THIS PROJECT GUTENBERG EBOOK FRANKENSTEIN *** - - - - -Produced by Judith Boss, Christy Phillips, Lynn Hanninen, -and David Meltzer. HTML version by Al Haines. - - - - - - - - - - -Frankenstein, - -or the Modern Prometheus - - -by - -Mary Wollstonecraft (Godwin) Shelley - - - - -Letter 1 - - -St. Petersburgh, Dec. 11th, 17-- - -TO Mrs. Saville, England - -You will rejoice to hear that no disaster has accompanied the -commencement of an enterprise which you have regarded with such evil -forebodings. I arrived here yesterday, and my first task is to assure -my dear sister of my welfare and increasing confidence in the success -of my undertaking. - -I am already far north of London, and as I walk in the streets of -Petersburgh, I feel a cold northern breeze play upon my cheeks, which -braces my nerves and fills me with delight. Do you understand this -feeling? This breeze, which has travelled from the regions towards -which I am advancing, gives me a foretaste of those icy climes. -Inspirited by this wind of promise, my daydreams become more fervent -and vivid. I try in vain to be persuaded that the pole is the seat of -frost and desolation; it ever presents itself to my imagination as the -region of beauty and delight. There, Margaret, the sun is forever -visible, its broad disk just skirting the horizon and diffusing a -perpetual splendour. There--for with your leave, my sister, I will put -some trust in preceding navigators--there snow and frost are banished; -and, sailing over a calm sea, we may be wafted to a land surpassing in -wonders and in beauty every region hitherto discovered on the habitable -globe. Its productions and features may be without example, as the -phenomena of the heavenly bodies undoubtedly are in those undiscovered -solitudes. What may not be expected in a country of eternal light? I -may there discover the wondrous power which attracts the needle and may -regulate a thousand celestial observations that require only this -voyage to render their seeming eccentricities consistent forever. I -shall satiate my ardent curiosity with the sight of a part of the world -never before visited, and may tread a land never before imprinted by -the foot of man. These are my enticements, and they are sufficient to -conquer all fear of danger or death and to induce me to commence this -laborious voyage with the joy a child feels when he embarks in a little -boat, with his holiday mates, on an expedition of discovery up his -native river. But supposing all these conjectures to be false, you -cannot contest the inestimable benefit which I shall confer on all -mankind, to the last generation, by discovering a passage near the pole -to those countries, to reach which at present so many months are -requisite; or by ascertaining the secret of the magnet, which, if at -all possible, can only be effected by an undertaking such as mine. - -These reflections have dispelled the agitation with which I began my -letter, and I feel my heart glow with an enthusiasm which elevates me -to heaven, for nothing contributes so much to tranquillize the mind as -a steady purpose--a point on which the soul may fix its intellectual -eye. This expedition has been the favourite dream of my early years. I -have read with ardour the accounts of the various voyages which have -been made in the prospect of arriving at the North Pacific Ocean -through the seas which surround the pole. You may remember that a -history of all the voyages made for purposes of discovery composed the -whole of our good Uncle Thomas' library. My education was neglected, -yet I was passionately fond of reading. These volumes were my study -day and night, and my familiarity with them increased that regret which -I had felt, as a child, on learning that my father's dying injunction -had forbidden my uncle to allow me to embark in a seafaring life. - -These visions faded when I perused, for the first time, those poets -whose effusions entranced my soul and lifted it to heaven. I also -became a poet and for one year lived in a paradise of my own creation; -I imagined that I also might obtain a niche in the temple where the -names of Homer and Shakespeare are consecrated. You are well -acquainted with my failure and how heavily I bore the disappointment. -But just at that time I inherited the fortune of my cousin, and my -thoughts were turned into the channel of their earlier bent. - -Six years have passed since I resolved on my present undertaking. I -can, even now, remember the hour from which I dedicated myself to this -great enterprise. I commenced by inuring my body to hardship. I -accompanied the whale-fishers on several expeditions to the North Sea; -I voluntarily endured cold, famine, thirst, and want of sleep; I often -worked harder than the common sailors during the day and devoted my -nights to the study of mathematics, the theory of medicine, and those -branches of physical science from which a naval adventurer might derive -the greatest practical advantage. Twice I actually hired myself as an -under-mate in a Greenland whaler, and acquitted myself to admiration. I -must own I felt a little proud when my captain offered me the second -dignity in the vessel and entreated me to remain with the greatest -earnestness, so valuable did he consider my services. And now, dear -Margaret, do I not deserve to accomplish some great purpose? My life -might have been passed in ease and luxury, but I preferred glory to -every enticement that wealth placed in my path. Oh, that some -encouraging voice would answer in the affirmative! My courage and my -resolution is firm; but my hopes fluctuate, and my spirits are often -depressed. I am about to proceed on a long and difficult voyage, the -emergencies of which will demand all my fortitude: I am required not -only to raise the spirits of others, but sometimes to sustain my own, -when theirs are failing. - -This is the most favourable period for travelling in Russia. They fly -quickly over the snow in their sledges; the motion is pleasant, and, in -my opinion, far more agreeable than that of an English stagecoach. The -cold is not excessive, if you are wrapped in furs--a dress which I have -already adopted, for there is a great difference between walking the -deck and remaining seated motionless for hours, when no exercise -prevents the blood from actually freezing in your veins. I have no -ambition to lose my life on the post-road between St. Petersburgh and -Archangel. I shall depart for the latter town in a fortnight or three -weeks; and my intention is to hire a ship there, which can easily be -done by paying the insurance for the owner, and to engage as many -sailors as I think necessary among those who are accustomed to the -whale-fishing. I do not intend to sail until the month of June; and -when shall I return? Ah, dear sister, how can I answer this question? -If I succeed, many, many months, perhaps years, will pass before you -and I may meet. If I fail, you will see me again soon, or never. -Farewell, my dear, excellent Margaret. Heaven shower down blessings on -you, and save me, that I may again and again testify my gratitude for -all your love and kindness. - -Your affectionate brother, - R. Walton"); - } -} \ No newline at end of file diff --git a/BlastPDF.Test/Filters/FilterTestHelpers.cs b/BlastPDF.Test/Filters/FilterTestHelpers.cs deleted file mode 100644 index eb73749..0000000 --- a/BlastPDF.Test/Filters/FilterTestHelpers.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text; -using BlastPDF.Filter; -using BlastSharp.Lists; -using Xunit; - -namespace BlastPDF.Test.Filters; - -public class FilterTestHelpers -{ - // The idea is if the encoders and decoders are working properly then: - // value == decode(encode(value)) - public static void TestFilter(PdfFilter filter, string value) - { - var bytes = Encoding.ASCII.GetBytes(value); - var encoded = filter.Encode(bytes); - var decoded = filter.Decode(encoded); - var (diffOffset, leftDiff, rightDiff) = bytes.FirstDifference(decoded); - Assert.True(diffOffset == -1, $"The encoder + decoder didn't produce the expected output at byte offset {diffOffset}. {leftDiff} != {rightDiff}"); - } -} \ No newline at end of file diff --git a/BlastPDF.Test/Filters/LzwTests.cs b/BlastPDF.Test/Filters/LzwTests.cs deleted file mode 100644 index 12472b5..0000000 --- a/BlastPDF.Test/Filters/LzwTests.cs +++ /dev/null @@ -1,188 +0,0 @@ -using BlastPDF.Filter; -using Xunit; - -namespace BlastPDF.Test.Filters; - -public class LzwTests -{ - - [Fact] - public void Test1() - { - FilterTestHelpers.TestFilter(PdfFilter.Lzw, "this is a test of the lzw filter"); - } - - [Fact] - public void Test2() - { - FilterTestHelpers.TestFilter(PdfFilter.Lzw, "this?"); - } - - [Fact] - public void Test3() - { - FilterTestHelpers.TestFilter(PdfFilter.Lzw, @" -Project Gutenberg's Frankenstein, by Mary Wollstonecraft (Godwin) Shelley - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - - -Title: Frankenstein - or The Modern Prometheus - -Author: Mary Wollstonecraft (Godwin) Shelley - -Release Date: June 17, 2008 [EBook #84] - -Language: English - - -*** START OF THIS PROJECT GUTENBERG EBOOK FRANKENSTEIN *** - - - - -Produced by Judith Boss, Christy Phillips, Lynn Hanninen, -and David Meltzer. HTML version by Al Haines. - - - - - - - - - - -Frankenstein, - -or the Modern Prometheus - - -by - -Mary Wollstonecraft (Godwin) Shelley - - - - -Letter 1 - - -St. Petersburgh, Dec. 11th, 17-- - -TO Mrs. Saville, England - -You will rejoice to hear that no disaster has accompanied the -commencement of an enterprise which you have regarded with such evil -forebodings. I arrived here yesterday, and my first task is to assure -my dear sister of my welfare and increasing confidence in the success -of my undertaking. - -I am already far north of London, and as I walk in the streets of -Petersburgh, I feel a cold northern breeze play upon my cheeks, which -braces my nerves and fills me with delight. Do you understand this -feeling? This breeze, which has travelled from the regions towards -which I am advancing, gives me a foretaste of those icy climes. -Inspirited by this wind of promise, my daydreams become more fervent -and vivid. I try in vain to be persuaded that the pole is the seat of -frost and desolation; it ever presents itself to my imagination as the -region of beauty and delight. There, Margaret, the sun is forever -visible, its broad disk just skirting the horizon and diffusing a -perpetual splendour. There--for with your leave, my sister, I will put -some trust in preceding navigators--there snow and frost are banished; -and, sailing over a calm sea, we may be wafted to a land surpassing in -wonders and in beauty every region hitherto discovered on the habitable -globe. Its productions and features may be without example, as the -phenomena of the heavenly bodies undoubtedly are in those undiscovered -solitudes. What may not be expected in a country of eternal light? I -may there discover the wondrous power which attracts the needle and may -regulate a thousand celestial observations that require only this -voyage to render their seeming eccentricities consistent forever. I -shall satiate my ardent curiosity with the sight of a part of the world -never before visited, and may tread a land never before imprinted by -the foot of man. These are my enticements, and they are sufficient to -conquer all fear of danger or death and to induce me to commence this -laborious voyage with the joy a child feels when he embarks in a little -boat, with his holiday mates, on an expedition of discovery up his -native river. But supposing all these conjectures to be false, you -cannot contest the inestimable benefit which I shall confer on all -mankind, to the last generation, by discovering a passage near the pole -to those countries, to reach which at present so many months are -requisite; or by ascertaining the secret of the magnet, which, if at -all possible, can only be effected by an undertaking such as mine. - -These reflections have dispelled the agitation with which I began my -letter, and I feel my heart glow with an enthusiasm which elevates me -to heaven, for nothing contributes so much to tranquillize the mind as -a steady purpose--a point on which the soul may fix its intellectual -eye. This expedition has been the favourite dream of my early years. I -have read with ardour the accounts of the various voyages which have -been made in the prospect of arriving at the North Pacific Ocean -through the seas which surround the pole. You may remember that a -history of all the voyages made for purposes of discovery composed the -whole of our good Uncle Thomas' library. My education was neglected, -yet I was passionately fond of reading. These volumes were my study -day and night, and my familiarity with them increased that regret which -I had felt, as a child, on learning that my father's dying injunction -had forbidden my uncle to allow me to embark in a seafaring life. - -These visions faded when I perused, for the first time, those poets -whose effusions entranced my soul and lifted it to heaven. I also -became a poet and for one year lived in a paradise of my own creation; -I imagined that I also might obtain a niche in the temple where the -names of Homer and Shakespeare are consecrated. You are well -acquainted with my failure and how heavily I bore the disappointment. -But just at that time I inherited the fortune of my cousin, and my -thoughts were turned into the channel of their earlier bent. - -Six years have passed since I resolved on my present undertaking. I -can, even now, remember the hour from which I dedicated myself to this -great enterprise. I commenced by inuring my body to hardship. I -accompanied the whale-fishers on several expeditions to the North Sea; -I voluntarily endured cold, famine, thirst, and want of sleep; I often -worked harder than the common sailors during the day and devoted my -nights to the study of mathematics, the theory of medicine, and those -branches of physical science from which a naval adventurer might derive -the greatest practical advantage. Twice I actually hired myself as an -under-mate in a Greenland whaler, and acquitted myself to admiration. I -must own I felt a little proud when my captain offered me the second -dignity in the vessel and entreated me to remain with the greatest -earnestness, so valuable did he consider my services. And now, dear -Margaret, do I not deserve to accomplish some great purpose? My life -might have been passed in ease and luxury, but I preferred glory to -every enticement that wealth placed in my path. Oh, that some -encouraging voice would answer in the affirmative! My courage and my -resolution is firm; but my hopes fluctuate, and my spirits are often -depressed. I am about to proceed on a long and difficult voyage, the -emergencies of which will demand all my fortitude: I am required not -only to raise the spirits of others, but sometimes to sustain my own, -when theirs are failing. - -This is the most favourable period for travelling in Russia. They fly -quickly over the snow in their sledges; the motion is pleasant, and, in -my opinion, far more agreeable than that of an English stagecoach. The -cold is not excessive, if you are wrapped in furs--a dress which I have -already adopted, for there is a great difference between walking the -deck and remaining seated motionless for hours, when no exercise -prevents the blood from actually freezing in your veins. I have no -ambition to lose my life on the post-road between St. Petersburgh and -Archangel. I shall depart for the latter town in a fortnight or three -weeks; and my intention is to hire a ship there, which can easily be -done by paying the insurance for the owner, and to engage as many -sailors as I think necessary among those who are accustomed to the -whale-fishing. I do not intend to sail until the month of June; and -when shall I return? Ah, dear sister, how can I answer this question? -If I succeed, many, many months, perhaps years, will pass before you -and I may meet. If I fail, you will see me again soon, or never. -Farewell, my dear, excellent Margaret. Heaven shower down blessings on -you, and save me, that I may again and again testify my gratitude for -all your love and kindness. - -Your affectionate brother, - R. Walton"); - } -} \ No newline at end of file diff --git a/BlastPDF.Test/Filters/RunLengthTests.cs b/BlastPDF.Test/Filters/RunLengthTests.cs deleted file mode 100644 index 120deeb..0000000 --- a/BlastPDF.Test/Filters/RunLengthTests.cs +++ /dev/null @@ -1,187 +0,0 @@ -using BlastPDF.Filter; -using Xunit; - -namespace BlastPDF.Test.Filters; - -public class RunLengthTests -{ - [Fact] - public void Test1() - { - FilterTestHelpers.TestFilter(PdfFilter.RunLength, "this is a test of the lzw filter"); - } - - [Fact] - public void Test2() - { - FilterTestHelpers.TestFilter(PdfFilter.RunLength, "this?"); - } - - [Fact] - public void Test3() - { - FilterTestHelpers.TestFilter(PdfFilter.RunLength, @" -Project Gutenberg's Frankenstein, by Mary Wollstonecraft (Godwin) Shelley - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - - -Title: Frankenstein - or The Modern Prometheus - -Author: Mary Wollstonecraft (Godwin) Shelley - -Release Date: June 17, 2008 [EBook #84] - -Language: English - - -*** START OF THIS PROJECT GUTENBERG EBOOK FRANKENSTEIN *** - - - - -Produced by Judith Boss, Christy Phillips, Lynn Hanninen, -and David Meltzer. HTML version by Al Haines. - - - - - - - - - - -Frankenstein, - -or the Modern Prometheus - - -by - -Mary Wollstonecraft (Godwin) Shelley - - - - -Letter 1 - - -St. Petersburgh, Dec. 11th, 17-- - -TO Mrs. Saville, England - -You will rejoice to hear that no disaster has accompanied the -commencement of an enterprise which you have regarded with such evil -forebodings. I arrived here yesterday, and my first task is to assure -my dear sister of my welfare and increasing confidence in the success -of my undertaking. - -I am already far north of London, and as I walk in the streets of -Petersburgh, I feel a cold northern breeze play upon my cheeks, which -braces my nerves and fills me with delight. Do you understand this -feeling? This breeze, which has travelled from the regions towards -which I am advancing, gives me a foretaste of those icy climes. -Inspirited by this wind of promise, my daydreams become more fervent -and vivid. I try in vain to be persuaded that the pole is the seat of -frost and desolation; it ever presents itself to my imagination as the -region of beauty and delight. There, Margaret, the sun is forever -visible, its broad disk just skirting the horizon and diffusing a -perpetual splendour. There--for with your leave, my sister, I will put -some trust in preceding navigators--there snow and frost are banished; -and, sailing over a calm sea, we may be wafted to a land surpassing in -wonders and in beauty every region hitherto discovered on the habitable -globe. Its productions and features may be without example, as the -phenomena of the heavenly bodies undoubtedly are in those undiscovered -solitudes. What may not be expected in a country of eternal light? I -may there discover the wondrous power which attracts the needle and may -regulate a thousand celestial observations that require only this -voyage to render their seeming eccentricities consistent forever. I -shall satiate my ardent curiosity with the sight of a part of the world -never before visited, and may tread a land never before imprinted by -the foot of man. These are my enticements, and they are sufficient to -conquer all fear of danger or death and to induce me to commence this -laborious voyage with the joy a child feels when he embarks in a little -boat, with his holiday mates, on an expedition of discovery up his -native river. But supposing all these conjectures to be false, you -cannot contest the inestimable benefit which I shall confer on all -mankind, to the last generation, by discovering a passage near the pole -to those countries, to reach which at present so many months are -requisite; or by ascertaining the secret of the magnet, which, if at -all possible, can only be effected by an undertaking such as mine. - -These reflections have dispelled the agitation with which I began my -letter, and I feel my heart glow with an enthusiasm which elevates me -to heaven, for nothing contributes so much to tranquillize the mind as -a steady purpose--a point on which the soul may fix its intellectual -eye. This expedition has been the favourite dream of my early years. I -have read with ardour the accounts of the various voyages which have -been made in the prospect of arriving at the North Pacific Ocean -through the seas which surround the pole. You may remember that a -history of all the voyages made for purposes of discovery composed the -whole of our good Uncle Thomas' library. My education was neglected, -yet I was passionately fond of reading. These volumes were my study -day and night, and my familiarity with them increased that regret which -I had felt, as a child, on learning that my father's dying injunction -had forbidden my uncle to allow me to embark in a seafaring life. - -These visions faded when I perused, for the first time, those poets -whose effusions entranced my soul and lifted it to heaven. I also -became a poet and for one year lived in a paradise of my own creation; -I imagined that I also might obtain a niche in the temple where the -names of Homer and Shakespeare are consecrated. You are well -acquainted with my failure and how heavily I bore the disappointment. -But just at that time I inherited the fortune of my cousin, and my -thoughts were turned into the channel of their earlier bent. - -Six years have passed since I resolved on my present undertaking. I -can, even now, remember the hour from which I dedicated myself to this -great enterprise. I commenced by inuring my body to hardship. I -accompanied the whale-fishers on several expeditions to the North Sea; -I voluntarily endured cold, famine, thirst, and want of sleep; I often -worked harder than the common sailors during the day and devoted my -nights to the study of mathematics, the theory of medicine, and those -branches of physical science from which a naval adventurer might derive -the greatest practical advantage. Twice I actually hired myself as an -under-mate in a Greenland whaler, and acquitted myself to admiration. I -must own I felt a little proud when my captain offered me the second -dignity in the vessel and entreated me to remain with the greatest -earnestness, so valuable did he consider my services. And now, dear -Margaret, do I not deserve to accomplish some great purpose? My life -might have been passed in ease and luxury, but I preferred glory to -every enticement that wealth placed in my path. Oh, that some -encouraging voice would answer in the affirmative! My courage and my -resolution is firm; but my hopes fluctuate, and my spirits are often -depressed. I am about to proceed on a long and difficult voyage, the -emergencies of which will demand all my fortitude: I am required not -only to raise the spirits of others, but sometimes to sustain my own, -when theirs are failing. - -This is the most favourable period for travelling in Russia. They fly -quickly over the snow in their sledges; the motion is pleasant, and, in -my opinion, far more agreeable than that of an English stagecoach. The -cold is not excessive, if you are wrapped in furs--a dress which I have -already adopted, for there is a great difference between walking the -deck and remaining seated motionless for hours, when no exercise -prevents the blood from actually freezing in your veins. I have no -ambition to lose my life on the post-road between St. Petersburgh and -Archangel. I shall depart for the latter town in a fortnight or three -weeks; and my intention is to hire a ship there, which can easily be -done by paying the insurance for the owner, and to engage as many -sailors as I think necessary among those who are accustomed to the -whale-fishing. I do not intend to sail until the month of June; and -when shall I return? Ah, dear sister, how can I answer this question? -If I succeed, many, many months, perhaps years, will pass before you -and I may meet. If I fail, you will see me again soon, or never. -Farewell, my dear, excellent Margaret. Heaven shower down blessings on -you, and save me, that I may again and again testify my gratitude for -all your love and kindness. - -Your affectionate brother, - R. Walton"); - } -} \ No newline at end of file diff --git a/BlastPDF.sln b/BlastPDF.sln index 069e7df..2c22199 100644 --- a/BlastPDF.sln +++ b/BlastPDF.sln @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowCase", "ShowCase\ShowCa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlastPDF.Test", "BlastPDF.Test\BlastPDF.Test.csproj", "{331127D4-4996-4D21-A808-09CA2B2CC975}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlastSharp", "BlastSharp\BlastSharp.csproj", "{F33137B6-7508-4D56-80B8-1D42723DCE7C}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlastPDF.Template", "BlastPDF.Template\BlastPDF.Template.csproj", "{221C8A28-642A-447B-874D-0D09542F1A58}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlastType", "BlastType\BlastType.csproj", "{B12ED74F-00BA-4915-9157-13016E32C2BD}" @@ -64,18 +62,6 @@ Global {331127D4-4996-4D21-A808-09CA2B2CC975}.Release|x64.Build.0 = Release|Any CPU {331127D4-4996-4D21-A808-09CA2B2CC975}.Release|x86.ActiveCfg = Release|Any CPU {331127D4-4996-4D21-A808-09CA2B2CC975}.Release|x86.Build.0 = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|x64.ActiveCfg = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|x64.Build.0 = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|x86.ActiveCfg = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Debug|x86.Build.0 = Debug|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|Any CPU.Build.0 = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|x64.ActiveCfg = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|x64.Build.0 = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|x86.ActiveCfg = Release|Any CPU - {F33137B6-7508-4D56-80B8-1D42723DCE7C}.Release|x86.Build.0 = Release|Any CPU {221C8A28-642A-447B-874D-0D09542F1A58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {221C8A28-642A-447B-874D-0D09542F1A58}.Debug|Any CPU.Build.0 = Debug|Any CPU {221C8A28-642A-447B-874D-0D09542F1A58}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/BlastPDF/BlastPDF.csproj b/BlastPDF/BlastPDF.csproj index 99f276d..7e9eeed 100644 --- a/BlastPDF/BlastPDF.csproj +++ b/BlastPDF/BlastPDF.csproj @@ -5,9 +5,8 @@ + - - diff --git a/BlastPDF/Builder/PdfValue.cs b/BlastPDF/Builder/PdfValue.cs index 2d6466e..8c9ad62 100644 --- a/BlastPDF/Builder/PdfValue.cs +++ b/BlastPDF/Builder/PdfValue.cs @@ -1,5 +1,4 @@ using System; -using BlastSharp.Text; namespace BlastPDF.Builder; diff --git a/BlastPDF/Builder/Util.cs b/BlastPDF/Builder/Util.cs new file mode 100644 index 0000000..da06f85 --- /dev/null +++ b/BlastPDF/Builder/Util.cs @@ -0,0 +1,27 @@ +using System.Linq; + +namespace BlastPDF.Builder; + +public static class Util +{ + public static string EscapedString(this string input) + { + return input.Aggregate("", (current, c) => current + c switch + { + '\\' => "\\\\", + '"' => "\\\"", + '\'' => "\\'", + (char)0 => "\\0", + '\a' => "\\a", + '\b' => "\\b", + '\f' => "\\f", + '\n' => "\\n", + '\r' => "\\r", + '\t' => "\\t", + '\v' => "\\v", + '(' => "\\(", + ')' => "\\)", + _ => $"{c}" + }); + } +} \ No newline at end of file diff --git a/BlastPDF/Exporter/Basic/BasicExporter.cs b/BlastPDF/Exporter/Basic/BasicExporter.cs index f0839b3..b82b206 100644 --- a/BlastPDF/Exporter/Basic/BasicExporter.cs +++ b/BlastPDF/Exporter/Basic/BasicExporter.cs @@ -6,11 +6,10 @@ using BlastPDF.Builder; using BlastPDF.Builder.Graphics; using BlastPDF.Builder.Graphics.Drawing; -using BlastPDF.Builder.Resources; using BlastPDF.Builder.Resources.Font; using BlastPDF.Builder.Resources.Image; using BlastPDF.Filter; -using BlastSharp.Lists; +using MyLib.Enumerables; using SharperImage.Enumerators; namespace BlastPDF.Exporter.Basic; diff --git a/BlastPDF/Filter/Implementations/Ascii85.cs b/BlastPDF/Filter/Implementations/Ascii85.cs deleted file mode 100644 index 93c175e..0000000 --- a/BlastPDF/Filter/Implementations/Ascii85.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using BlastSharp.Lists; - -namespace BlastPDF.Filter.Implementations; - -public class Ascii85 : IFilterAlgorithm -{ - public IEnumerable Encode(IEnumerable input) - { - var chunked = input.Chunk(4); - var results = new List(); - foreach (var chunk in chunked) - { - var padded = chunk.PadRight(4, (byte)0); - if (BitConverter.IsLittleEndian) - padded = padded.Reverse(); - var value = BitConverter.ToUInt32(padded.ToArray()); - if (value == 0) return new byte[]{122}; - var fixedChunk = new byte[5]; - var i = 4; - while (value > 0) - { - fixedChunk[i--] = (byte)(value % 85 + 33); - value /= 85; - } - results.AddRange(fixedChunk.Take(chunk.Length + 1)); - } - - return results.Concat(new[]{(byte)'~', (byte)'>'}); - } - - public IEnumerable Decode(IEnumerable input) - { - var filtered = input.Where(x => !char.IsWhiteSpace((char)x)); - if (System.Text.Encoding.ASCII.GetString(filtered.Skip(filtered.Count() - 2).Take(2).ToArray()) != "~>") - { - throw new ArgumentException("Sequence must end in a '~>'.", nameof(input)); - } - - var contents = filtered.Take(filtered.Count() - 2).ToList(); - if (contents.Any(x => x is not (>= 33 and <= 117) or 122)) - { - throw new ArgumentException("Sequence must contain only characters between '!' and 'u'; and 'z'"); - } - - var results = new List(); - var contentIndex = 0; - - while (contentIndex < contents.Count) - { - List toAdd; - if (contents[contentIndex] == 'z') - { - toAdd = new List{0, 0, 0, 0}; - contentIndex += 1; - } - else - { - var chunk = contents.Skip(contentIndex).Take(5); - var padded = chunk.Select(x => (byte)(x - 33)).PadRight(5, (byte)84); - var value = padded.Aggregate((uint)0, (total, next) => 85 * total + next); - toAdd = BitConverter.GetBytes(value).ToList(); - if (BitConverter.IsLittleEndian) - toAdd.Reverse(); - toAdd = toAdd.Take(chunk.Count() - 1).ToList(); - contentIndex += chunk.Count(); - } - results.AddRange(toAdd); - } - - return results;; - } -} \ No newline at end of file diff --git a/BlastPDF/Filter/Implementations/AsciiHex.cs b/BlastPDF/Filter/Implementations/AsciiHex.cs deleted file mode 100644 index 05a8fe4..0000000 --- a/BlastPDF/Filter/Implementations/AsciiHex.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace BlastPDF.Filter.Implementations; - -public class AsciiHex : IFilterAlgorithm -{ - private static byte ToHex(int b) - { - if (b is < 0 or > 15) - throw new ArgumentOutOfRangeException(nameof(b), b, "Value must be greater than 0 and less than 16"); - return (byte)(b < 10 ? b + 48 : b + 55); - } - - private static byte FromHex(byte b) - { - return b switch - { - <= 57 and >= 48 => (byte) (b - 48), - <= 70 and >= 65 => (byte) (b - 55), - <= 102 and >= 97 => (byte) (b - 87), - _ => throw new ArgumentException($"Unexpected value of argument: '{Convert.ToInt32(b)}'", nameof(b)) - }; - } - - private static byte FromHex(byte top, byte bottom) => (byte)((FromHex(top) << 4) + FromHex(bottom)); - - public IEnumerable Encode(IEnumerable input) - { - return input.SelectMany(x => new List {ToHex(x / 16), ToHex(x % 16)}).Append((byte)'>'); - } - - public IEnumerable Decode(IEnumerable input) - { - var filtered = input.Where(x => !char.IsWhiteSpace((char)x)).ToList(); - if (filtered.LastOrDefault() != (byte) '>') - { - throw new ArgumentException("Sequence must end in a '>'.", nameof(input)); - } - - var contents = filtered.Take(filtered.Count - 1).ToList(); - if (contents.Any(x => x is not ((>= 48 and <= 57) or (>= 65 and <= 70) or (>= 97 and <= 102)))) - { - throw new ArgumentException("Sequence must contain only characters that match regex: '[0-9A-Za-z]|\\w'"); - } - - return contents.Chunk(2).Select(x => FromHex(x[0], x.Length == 1 ? (byte) 0 : x[1])); - } -} \ No newline at end of file diff --git a/BlastPDF/Filter/Implementations/Lzw.cs b/BlastPDF/Filter/Implementations/Lzw.cs deleted file mode 100644 index 720b240..0000000 --- a/BlastPDF/Filter/Implementations/Lzw.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using BlastSharp.Lists; - -namespace BlastPDF.Filter.Implementations; - -public class LzwParameters : IFilterParameters -{ - public int Predictor { get; set; } = 1; - public int Colors { get; set; } = 1; - public int BitsPerComponent { get; set; } = 8; - public int Columns { get; set; } = 1; - public int EarlyChange { get; set; } = 1; -} - -public class Lzw : IFilterAlgorithm -{ - // FIXME actually utilize this parameters :) - private LzwParameters LzwParameters { get; } = new(); - - private Dictionary codewords { get; set; } = new(); - private Dictionary> values { get; set; } = new(); - - public Lzw(LzwParameters parameters) - { - if (parameters == null) return; - if (parameters.Predictor is not (1 or 2 or 10 or 11 or 12 or 13 or 14 or 15)) - throw new ArgumentOutOfRangeException(nameof(parameters.Predictor), "Predictor should be 1, 2, 10, 11, 12, 13, 14, or 15."); - if (parameters.Colors < 1) - throw new ArgumentOutOfRangeException(nameof(parameters.Colors), "Colors must be greater than or equal to 1."); - if (parameters.BitsPerComponent is not (1 or 2 or 4 or 8 or 16)) - throw new ArgumentOutOfRangeException(nameof(parameters.BitsPerComponent), - "BitsPerComponent must be 1, 2, 4, 8, or 16."); - if (parameters.EarlyChange is not 1 and not 2) - throw new ArgumentOutOfRangeException(nameof(parameters.EarlyChange), "EarlyChange must be 0 or 1."); - LzwParameters = parameters; - } - - private int GetCodeword(IEnumerable input) - { - return codewords[input.Hash()]; - } - - private bool ContainsCodeword(IEnumerable input) - { - return codewords.ContainsKey(input.Hash()); - } - - private void InsertCodeword(IEnumerable input, int code) - { - codewords[input.Hash()] = code; - } - - private (int, int) ClearCodewords() - { - codewords = new Dictionary(); - for (var i = 0; i < 256; i++) - { - InsertCodeword(new[] {(byte) i}, i); - } - return (EOD + 1, 9); - } - - private (int, int) ClearValues() - { - values = new Dictionary>(); - for (var i = 0; i < 256; i++) - { - InsertValue(i, new[] {(byte) i}); - } - return (EOD + 1, 9); - } - - private IEnumerable GetValue(int input) - { - return values[input]; - } - - private bool ContainsValue(int input) - { - return values.ContainsKey(input); - } - - private void InsertValue(int input, IEnumerable value) - { - values[input] = value; - } - - private const int EOD = 257; - private const int CLEAR_TABLE = 256; - - public IEnumerable Encode(IEnumerable input) - { - var (currentCodeValue, currentCodeLength) = ClearCodewords(); - - var buffer = Array.Empty(); - var result = new BitList(); - - foreach (var b in input) - { - var combined = buffer.Append(b); - if (ContainsCodeword(combined)) - { - buffer = combined.ToArray(); - } - else - { - var codeword = GetCodeword(buffer); - result.AppendBits(codeword, currentCodeLength); - - InsertCodeword(combined, currentCodeValue); - currentCodeValue += 1; - if (currentCodeValue == 4096) - { - result.AppendBits(CLEAR_TABLE, currentCodeLength); - buffer = new[] {b}; - (currentCodeValue, currentCodeLength) = ClearCodewords(); - continue; - } - - buffer = new[] {b}; - currentCodeLength += currentCodeValue switch - { - 512 or 1024 or 2048 => 1, - _ => 0 - }; - } - } - result.AppendBits(GetCodeword(buffer), currentCodeLength); - result.AppendBits(EOD, currentCodeLength); // insert end of data - - return result.ToByteArray(); - } - - private static int GetBits(BitList inputBits, int offset, int amount) - { - var bits = inputBits.ReadBits(offset, amount).PadLeft(4, (byte) 0); - if (BitConverter.IsLittleEndian) - bits = bits.Reverse(); - return BitConverter.ToInt32(bits.ToArray()); - } - - public IEnumerable Decode(IEnumerable input) - { - var (currentCodeValue, currentCodeLength) = ClearValues(); - var currentBitOffset = 0; - - var inputBits = new BitList(input); - var result = new List(); - - var priorCodeWord = GetBits(inputBits, currentBitOffset, currentCodeLength); - // output prior code word - result.AddRange(GetValue(priorCodeWord)); - - currentBitOffset += currentCodeLength; - while (currentBitOffset < inputBits.Count) - { - var codeword = GetBits(inputBits, currentBitOffset, currentCodeLength); - - if (codeword == EOD) - { - break; - } - - if (codeword == CLEAR_TABLE) - { - currentBitOffset += currentCodeLength; - if (currentBitOffset >= inputBits.Count) break; - (currentCodeValue, currentCodeLength) = ClearValues(); - priorCodeWord = GetBits(inputBits, currentBitOffset, currentCodeLength); - result.AddRange(GetValue(priorCodeWord)); - currentBitOffset += currentCodeLength; - continue; - } - - if (ContainsValue(codeword)) - { - InsertValue(currentCodeValue, GetValue(priorCodeWord).Append(GetValue(codeword).First()).ToArray()); - currentCodeValue += 1; - - result.AddRange(GetValue(codeword)); - } - else - { - var priorCodeValue = GetValue(priorCodeWord); - var appended = priorCodeValue.Append(priorCodeValue.First()); - InsertValue(currentCodeValue, appended.ToArray()); - currentCodeValue += 1; - result.AddRange(appended); - } - priorCodeWord = codeword; - currentBitOffset += currentCodeLength; - if (currentCodeValue < 4096) - { - currentCodeLength += currentCodeValue switch - { - 511 or 1023 or 2047 => 1, - _ => 0 - }; - } - } - - return result; - } -} \ No newline at end of file diff --git a/BlastPDF/Filter/Implementations/PdfAscii85.cs b/BlastPDF/Filter/Implementations/PdfAscii85.cs new file mode 100644 index 0000000..8a27c1d --- /dev/null +++ b/BlastPDF/Filter/Implementations/PdfAscii85.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MyLib.Compression; +using MyLib.Compression.Interface; +using MyLib.Enumerables; + +namespace BlastPDF.Filter.Implementations; + +public class PdfAscii85 : ICompressionAlgorithm +{ + private Ascii85 algorithm = new(); + + public IEnumerable Encode(IEnumerable input) + { + return algorithm.Encode(input).Concat(new[]{(byte)'~', (byte)'>'}); + } + + public IEnumerable Decode(IEnumerable input) + { + var filtered = input.Where(x => !char.IsWhiteSpace((char)x)); + if (System.Text.Encoding.ASCII.GetString(filtered.Skip(filtered.Count() - 2).Take(2).ToArray()) != "~>") + { + throw new ArgumentException("Sequence must end in a '~>'.", nameof(input)); + } + + var contents = filtered.Take(filtered.Count() - 2).ToList(); + return algorithm.Decode(contents); + } +} \ No newline at end of file diff --git a/BlastPDF/Filter/Implementations/PdfAsciiHex.cs b/BlastPDF/Filter/Implementations/PdfAsciiHex.cs new file mode 100644 index 0000000..f6aec78 --- /dev/null +++ b/BlastPDF/Filter/Implementations/PdfAsciiHex.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using MyLib.Compression; +using MyLib.Compression.Interface; + +namespace BlastPDF.Filter.Implementations; + +public class PdfAsciiHex : ICompressionAlgorithm +{ + private AsciiHex algorithm = new(); + public IEnumerable Encode(IEnumerable input) + { + return algorithm.Encode(input).Append((byte)'>'); + } + + public IEnumerable Decode(IEnumerable input) + { + if (input.LastOrDefault() != (byte) '>') + { + throw new ArgumentException("Sequence must end in a '>'.", nameof(input)); + } + + return algorithm.Decode(input.Take(input.Count() - 1)); + } +} \ No newline at end of file diff --git a/BlastPDF/Filter/Implementations/RunLength.cs b/BlastPDF/Filter/Implementations/RunLength.cs deleted file mode 100644 index 66f6550..0000000 --- a/BlastPDF/Filter/Implementations/RunLength.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using BlastSharp.Lists; - -namespace BlastPDF.Filter.Implementations; - -public class RunLength : IFilterAlgorithm -{ - public IEnumerable Encode(IEnumerable input) - { - // encoding - // group same bytes into groups of (byte value, run length) - // group groups of run length = 1 into chunks of 128 - // if run length is greater than 1 - // emit {257 - run length, byte value} - // if run length is equal to 1 - // emit {length, chunked bytes} - // add byte 128 to end - - var groups = new List<(byte, int)>(); - (byte, int) currentGroup = (0, 0); - foreach (var i in input) - { - if (currentGroup.Item2 != 0 && currentGroup.Item1 == i && currentGroup.Item2 < 128) - { - currentGroup = (currentGroup.Item1, currentGroup.Item2 + 1); - } - else - { - if (currentGroup.Item2 > 0) groups.Add(currentGroup); - currentGroup = (i, 1); - } - } - if (currentGroup.Item2 > 0) groups.Add(currentGroup); - - var chunks = new List<(IEnumerable, int)>(); - var currentChunk = (new List(), 0); - foreach (var g in groups) - { - if(currentChunk.Item2 != 0 && g.Item2 == 1 && currentChunk.Item2 == 1 && currentChunk.Item1.Count < 128) - { - var a = currentChunk.Item1; - a.Add(g.Item1); - currentChunk = (a, currentChunk.Item2); - } - else - { - if (currentChunk.Item2 > 0) chunks.Add(currentChunk); - currentChunk = (new List{g.Item1}, g.Item2); - } - } - if (currentChunk.Item2 > 0) chunks.Add(currentChunk); - - return chunks.SelectMany(x => x.Item1 - .Prepend(x.Item2 == 1 ? (byte) (x.Item1.Count() - 1) : (byte) (257 - x.Item2))) - .Append((byte)128); - } - - public IEnumerable Decode(IEnumerable input) - { - // decoding - // length byte -> run - // if length is 0 to 127 then copy next length + 1 bytes literally - // if length is 129 to 255 then the next single byte should be copied 257 - length times - // length of 128 is EOD - var result = new List(); - for(var i = 0; i < input.Count(); i++) - { - var b = input.ElementAt(i); - if (b < 128) - { - result.AddRange(input.Skip(i + 1).Take(b + 1)); - i += b + 1; - } - else if (b > 128) - { - result.AddRange(input.ElementAt(i + 1).Repeat(257 - b)); - i += 1; - } - else - { - break; - } - } - - return result; - } -} \ No newline at end of file diff --git a/BlastPDF/Filter/PdfFilter.cs b/BlastPDF/Filter/PdfFilter.cs index a836616..ba1418b 100644 --- a/BlastPDF/Filter/PdfFilter.cs +++ b/BlastPDF/Filter/PdfFilter.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; -using BlastPDF.Filter; using BlastPDF.Filter.Implementations; +using MyLib.Compression; +using MyLib.Compression.Interface; namespace BlastPDF.Filter; @@ -21,13 +22,13 @@ public enum PdfFilter public static class PdfFilterExtensions { - private static IFilterAlgorithm Get(this PdfFilter decodeType, IFilterParameters parameters) + private static ICompressionAlgorithm Get(this PdfFilter decodeType) { return decodeType switch { - PdfFilter.AsciiHex => new AsciiHex(), - PdfFilter.Ascii85 => new Ascii85(), - PdfFilter.Lzw => new Lzw(parameters as LzwParameters), + PdfFilter.AsciiHex => new PdfAsciiHex(), + PdfFilter.Ascii85 => new PdfAscii85(), + PdfFilter.Lzw => new Lzw(), PdfFilter.Flate => throw new NotImplementedException(), PdfFilter.RunLength => new RunLength(), PdfFilter.CCITTFax => throw new NotImplementedException(), @@ -39,9 +40,9 @@ private static IFilterAlgorithm Get(this PdfFilter decodeType, IFilterParameters }; } - public static IEnumerable Encode(this PdfFilter filter, IEnumerable input, IFilterParameters parameters = null) => - filter.Get(parameters).Encode(input); + public static IEnumerable Encode(this PdfFilter filter, IEnumerable input) => + filter.Get().Encode(input); - public static IEnumerable Decode(this PdfFilter filter, IEnumerable input, IFilterParameters parameters = null) => - filter.Get(parameters).Decode(input); + public static IEnumerable Decode(this PdfFilter filter, IEnumerable input) => + filter.Get().Decode(input); } \ No newline at end of file diff --git a/BlastSharp/Text/StringExtensions.cs b/BlastSharp/Text/StringExtensions.cs index d2413c7..ee3374a 100644 --- a/BlastSharp/Text/StringExtensions.cs +++ b/BlastSharp/Text/StringExtensions.cs @@ -19,7 +19,7 @@ public static string EscapedString(this string input) '\v' => "\\v", '(' => "\\(", ')' => "\\)", - _ => c + _ => $"{c}" }); } } \ No newline at end of file diff --git a/BlastType/BlastFont.cs b/BlastType/BlastFont.cs index 1490c12..416a83b 100644 --- a/BlastType/BlastFont.cs +++ b/BlastType/BlastFont.cs @@ -1,7 +1,7 @@ using System.Text; -using BlastSharp.Streams; using BlastType.Internal; -using BlastType.Internal.GlyphDefinitionSubtables; +using MyLib.Enumerables; +using MyLib.Streams; namespace BlastType; @@ -72,7 +72,7 @@ private static BlastFont ParseFile(Stream fontFile) // TODO table should be non-nullable if we can process all table tags IFontTable? table = record.TableTagString switch { - //"CFF " => + "CFF " => CompactFontFormatTable.Load(fontFile), "cmap" => CharacterMapTable.Load(fontFile), "DSIG" => DigitalSignature.Load(fontFile), "GDEF" => GlyphDefinitionTable.Load(fontFile), @@ -89,9 +89,10 @@ private static BlastFont ParseFile(Stream fontFile) if (table == null) { + Console.WriteLine("UNIMPLEMENTED"); fontFile.Seek(record.Offset, SeekOrigin.Begin); var bytes = fontFile.ReadBytes((int)Math.Min(10, record.Length)); - Console.WriteLine(string.Join(' ', bytes.Select(x => x.ToString("X2")))); + Console.WriteLine(bytes.Select(x => x.ToString("X2")).Join(" ")); continue; } Console.WriteLine("TABLE::"); diff --git a/BlastType/BlastType.csproj b/BlastType/BlastType.csproj index b83acf2..80799b8 100644 --- a/BlastType/BlastType.csproj +++ b/BlastType/BlastType.csproj @@ -6,14 +6,15 @@ enable - - - - ..\..\..\.nuget\packages\newtonsoft.json\13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll + + + + + diff --git a/BlastType/Internal/CharacterMapSubtables/ByteEncodingTable.cs b/BlastType/Internal/CharacterMapSubtables/ByteEncodingTable.cs index e61cd04..0026a2b 100644 --- a/BlastType/Internal/CharacterMapSubtables/ByteEncodingTable.cs +++ b/BlastType/Internal/CharacterMapSubtables/ByteEncodingTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal.CharacterMapSubtables; diff --git a/BlastType/Internal/CharacterMapSubtables/ICharacterMapSubtable.cs b/BlastType/Internal/CharacterMapSubtables/ICharacterMapSubtable.cs index cc47984..fa1707b 100644 --- a/BlastType/Internal/CharacterMapSubtables/ICharacterMapSubtable.cs +++ b/BlastType/Internal/CharacterMapSubtables/ICharacterMapSubtable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal.CharacterMapSubtables; diff --git a/BlastType/Internal/CharacterMapSubtables/MixedCoverageTable.cs b/BlastType/Internal/CharacterMapSubtables/MixedCoverageTable.cs index ce15add..28bcd8b 100644 --- a/BlastType/Internal/CharacterMapSubtables/MixedCoverageTable.cs +++ b/BlastType/Internal/CharacterMapSubtables/MixedCoverageTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal.CharacterMapSubtables; diff --git a/BlastType/Internal/CharacterMapSubtables/SegmentMapTable.cs b/BlastType/Internal/CharacterMapSubtables/SegmentMapTable.cs index 3061ed3..29c5e09 100644 --- a/BlastType/Internal/CharacterMapSubtables/SegmentMapTable.cs +++ b/BlastType/Internal/CharacterMapSubtables/SegmentMapTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal.CharacterMapSubtables; diff --git a/BlastType/Internal/CharacterMapSubtables/TrimmedMappingTable.cs b/BlastType/Internal/CharacterMapSubtables/TrimmedMappingTable.cs index d203c06..295db03 100644 --- a/BlastType/Internal/CharacterMapSubtables/TrimmedMappingTable.cs +++ b/BlastType/Internal/CharacterMapSubtables/TrimmedMappingTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal.CharacterMapSubtables; diff --git a/BlastType/Internal/CharacterMapTable.cs b/BlastType/Internal/CharacterMapTable.cs index f23f38d..9ce849c 100644 --- a/BlastType/Internal/CharacterMapTable.cs +++ b/BlastType/Internal/CharacterMapTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/CompactFontFormatSubtables/CompactFontFormatHeader.cs b/BlastType/Internal/CompactFontFormatSubtables/CompactFontFormatHeader.cs new file mode 100644 index 0000000..26a4704 --- /dev/null +++ b/BlastType/Internal/CompactFontFormatSubtables/CompactFontFormatHeader.cs @@ -0,0 +1,23 @@ +using MyLib.Streams; + +namespace BlastType.Internal.CompactFontFormatSubtables; + +public class CompactFontFormatHeader +{ + public byte MajorVersion { get; set; } + public byte MinorVersion { get; set; } + public byte HeaderSize { get; set; } + public ushort TopDictLength { get; set; } + + public static CompactFontFormatHeader Load(Stream stream) + { + return new CompactFontFormatHeader + { + // TODO fix the readbyte call so we can just call that function directly + MajorVersion = stream.ReadBytes(1)[0], + MinorVersion = stream.ReadBytes(1)[0], + HeaderSize = stream.ReadBytes(1)[0], + TopDictLength = stream.ReadU16() + }; + } +} \ No newline at end of file diff --git a/BlastType/Internal/CompactFontFormatTable.cs b/BlastType/Internal/CompactFontFormatTable.cs index bd20e52..4acdad1 100644 --- a/BlastType/Internal/CompactFontFormatTable.cs +++ b/BlastType/Internal/CompactFontFormatTable.cs @@ -1,6 +1,23 @@ +using BlastType.Internal.CompactFontFormatSubtables; + namespace BlastType.Internal; -public class CompactFontFormatTable +public class CompactFontFormatTable : IFontTable { + public CompactFontFormatHeader Header { get; set; } + + public static CompactFontFormatTable Load(Stream stream) + { + CompactFontFormatHeader header = CompactFontFormatHeader.Load(stream); + + return new CompactFontFormatTable + { + Header = header + }; + } + public bool Is() + { + return typeof(T) == typeof(CompactFontFormatTable); + } } \ No newline at end of file diff --git a/BlastType/Internal/DataTypes/Fixed.cs b/BlastType/Internal/DataTypes/Fixed.cs index 9550094..e299201 100644 --- a/BlastType/Internal/DataTypes/Fixed.cs +++ b/BlastType/Internal/DataTypes/Fixed.cs @@ -1,4 +1,4 @@ -using BlastSharp.Lists; +using MyLib.Enumerables; namespace BlastType.Internal.DataTypes; diff --git a/BlastType/Internal/DigitalSignature.cs b/BlastType/Internal/DigitalSignature.cs index 620c8c6..1c859db 100644 --- a/BlastType/Internal/DigitalSignature.cs +++ b/BlastType/Internal/DigitalSignature.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/EncodingRecord.cs b/BlastType/Internal/EncodingRecord.cs index 2b8e288..834b879 100644 --- a/BlastType/Internal/EncodingRecord.cs +++ b/BlastType/Internal/EncodingRecord.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.CharacterMapSubtables; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/FontHeader.cs b/BlastType/Internal/FontHeader.cs index 4900bf9..363f540 100644 --- a/BlastType/Internal/FontHeader.cs +++ b/BlastType/Internal/FontHeader.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.DataTypes; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/GlyphDefinitionSubtables/AttachmentPointListTable.cs b/BlastType/Internal/GlyphDefinitionSubtables/AttachmentPointListTable.cs index e29ff01..110c7f8 100644 --- a/BlastType/Internal/GlyphDefinitionSubtables/AttachmentPointListTable.cs +++ b/BlastType/Internal/GlyphDefinitionSubtables/AttachmentPointListTable.cs @@ -1,5 +1,4 @@ -using BlastSharp.Streams; -using Newtonsoft.Json; +using MyLib.Streams; namespace BlastType.Internal.GlyphDefinitionSubtables; diff --git a/BlastType/Internal/GlyphDefinitionSubtables/ClassRangeRecord.cs b/BlastType/Internal/GlyphDefinitionSubtables/ClassRangeRecord.cs index bcb83f3..1133038 100644 --- a/BlastType/Internal/GlyphDefinitionSubtables/ClassRangeRecord.cs +++ b/BlastType/Internal/GlyphDefinitionSubtables/ClassRangeRecord.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal.GlyphDefinitionSubtables; diff --git a/BlastType/Internal/GlyphDefinitionSubtables/GlyphClassDefinitionTable.cs b/BlastType/Internal/GlyphDefinitionSubtables/GlyphClassDefinitionTable.cs index c3c1354..652266d 100644 --- a/BlastType/Internal/GlyphDefinitionSubtables/GlyphClassDefinitionTable.cs +++ b/BlastType/Internal/GlyphDefinitionSubtables/GlyphClassDefinitionTable.cs @@ -1,5 +1,4 @@ -using BlastSharp.Streams; -using Newtonsoft.Json; +using MyLib.Streams; namespace BlastType.Internal.GlyphDefinitionSubtables; diff --git a/BlastType/Internal/GlyphDefinitionTable.cs b/BlastType/Internal/GlyphDefinitionTable.cs index a7e7238..39659c2 100644 --- a/BlastType/Internal/GlyphDefinitionTable.cs +++ b/BlastType/Internal/GlyphDefinitionTable.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.GlyphDefinitionSubtables; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/GlyphPositioningSubtables/ScriptListTable.cs b/BlastType/Internal/GlyphPositioningSubtables/ScriptListTable.cs index e695fec..8727f6d 100644 --- a/BlastType/Internal/GlyphPositioningSubtables/ScriptListTable.cs +++ b/BlastType/Internal/GlyphPositioningSubtables/ScriptListTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal.GlyphPositioningSubtables; diff --git a/BlastType/Internal/GlyphPositioningSubtables/ScriptRecord.cs b/BlastType/Internal/GlyphPositioningSubtables/ScriptRecord.cs index 23bcb19..8913196 100644 --- a/BlastType/Internal/GlyphPositioningSubtables/ScriptRecord.cs +++ b/BlastType/Internal/GlyphPositioningSubtables/ScriptRecord.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal.GlyphPositioningSubtables; diff --git a/BlastType/Internal/GlyphPositioningTable.cs b/BlastType/Internal/GlyphPositioningTable.cs index f0656f7..877a844 100644 --- a/BlastType/Internal/GlyphPositioningTable.cs +++ b/BlastType/Internal/GlyphPositioningTable.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.GlyphPositioningSubtables; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/HorizontalHeader.cs b/BlastType/Internal/HorizontalHeader.cs index d2c949d..3e133a0 100644 --- a/BlastType/Internal/HorizontalHeader.cs +++ b/BlastType/Internal/HorizontalHeader.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/HorizontalMetrics.cs b/BlastType/Internal/HorizontalMetrics.cs index 8cd8afe..a9eb490 100644 --- a/BlastType/Internal/HorizontalMetrics.cs +++ b/BlastType/Internal/HorizontalMetrics.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/LanguageRecord.cs b/BlastType/Internal/LanguageRecord.cs index af1152a..ee9ade7 100644 --- a/BlastType/Internal/LanguageRecord.cs +++ b/BlastType/Internal/LanguageRecord.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/LongHorizontalMetric.cs b/BlastType/Internal/LongHorizontalMetric.cs index 7d5d76d..2c86aad 100644 --- a/BlastType/Internal/LongHorizontalMetric.cs +++ b/BlastType/Internal/LongHorizontalMetric.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/MaximumProfile.cs b/BlastType/Internal/MaximumProfile.cs index aaf00e6..6c90d31 100644 --- a/BlastType/Internal/MaximumProfile.cs +++ b/BlastType/Internal/MaximumProfile.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.DataTypes; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/NameRecord.cs b/BlastType/Internal/NameRecord.cs index 3b83ed7..07a2da9 100644 --- a/BlastType/Internal/NameRecord.cs +++ b/BlastType/Internal/NameRecord.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/NameTable.cs b/BlastType/Internal/NameTable.cs index a1dbac3..87a05da 100644 --- a/BlastType/Internal/NameTable.cs +++ b/BlastType/Internal/NameTable.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/Os2.cs b/BlastType/Internal/Os2.cs index dc2e175..2a048b0 100644 --- a/BlastType/Internal/Os2.cs +++ b/BlastType/Internal/Os2.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/PostTable.cs b/BlastType/Internal/PostTable.cs index b8eb4a5..d980aab 100644 --- a/BlastType/Internal/PostTable.cs +++ b/BlastType/Internal/PostTable.cs @@ -1,5 +1,5 @@ -using BlastSharp.Streams; using BlastType.Internal.DataTypes; +using MyLib.Streams; using Newtonsoft.Json; namespace BlastType.Internal; diff --git a/BlastType/Internal/SequentialMapGroup.cs b/BlastType/Internal/SequentialMapGroup.cs index b5b17b3..2b19fbc 100644 --- a/BlastType/Internal/SequentialMapGroup.cs +++ b/BlastType/Internal/SequentialMapGroup.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/SubHeader.cs b/BlastType/Internal/SubHeader.cs index 2a38ab3..44c85ac 100644 --- a/BlastType/Internal/SubHeader.cs +++ b/BlastType/Internal/SubHeader.cs @@ -1,4 +1,4 @@ -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/BlastType/Internal/TableRecord.cs b/BlastType/Internal/TableRecord.cs index 3440b8a..5833e39 100644 --- a/BlastType/Internal/TableRecord.cs +++ b/BlastType/Internal/TableRecord.cs @@ -1,5 +1,5 @@ using System.Text; -using BlastSharp.Streams; +using MyLib.Streams; namespace BlastType.Internal; diff --git a/ShowCase/PdfBuilderExample.cs b/ShowCase/PdfBuilderExample.cs index d3f88f2..bb89ad9 100644 --- a/ShowCase/PdfBuilderExample.cs +++ b/ShowCase/PdfBuilderExample.cs @@ -4,12 +4,11 @@ using BlastPDF.Builder; using BlastPDF.Builder.Graphics; using BlastPDF.Builder.Graphics.Drawing; -using BlastPDF.Builder.Resources; using BlastPDF.Builder.Resources.Font; using BlastPDF.Builder.Resources.Image; using BlastPDF.Exporter.Basic; using BlastPDF.Filter; -using BlastSharp.Dates; +using MyLib.DatesAndTimes; using SharperImage.Formats; namespace ShowCase; diff --git a/ShowCase/Program.cs b/ShowCase/Program.cs index f662b12..77ff5b0 100644 --- a/ShowCase/Program.cs +++ b/ShowCase/Program.cs @@ -4,7 +4,6 @@ using System.Text; using BlastPDF.Builder; using BlastPDF.Filter; -using BlastSharp.Lists; using BlastType; namespace ShowCase; @@ -12,7 +11,7 @@ namespace ShowCase; public class Program { public static void Main(string[] args) { - PdfBuilderExample.Run("megatest.pdf"); + //PdfBuilderExample.Run("megatest.pdf"); //ImageParsingExample.Run("../../../images/qoi/dice.qoi"); //ImageParsingExample.Run("../../../images/qoi/kodim10.qoi"); //ImageParsingExample.Run("../../../images/qoi/kodim23.qoi"); @@ -22,7 +21,7 @@ public static void Main(string[] args) //ImageParsingExample.Run("../../../images/qoi/wikipedia_008.qoi"); //ImageParsingExample.Run("../../../images/gif/bird.gif"); - //BlastFont.Load("../../../../Samples/airtraveler.otf"); + BlastFont.Load("../../../../Samples/airtraveler.otf"); } }