diff --git a/AideDeJeu/AideDeJeu.Android/AideDeJeu.Android.csproj b/AideDeJeu/AideDeJeu.Android/AideDeJeu.Android.csproj index 7392efb1..b370fa95 100644 --- a/AideDeJeu/AideDeJeu.Android/AideDeJeu.Android.csproj +++ b/AideDeJeu/AideDeJeu.Android/AideDeJeu.Android.csproj @@ -89,6 +89,9 @@ 4.5.2 + + 4.5.1 + 1.1.0 diff --git a/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj b/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj index 082b6e41..b48de2a8 100644 --- a/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj +++ b/AideDeJeu/AideDeJeu.GTK/AideDeJeu.GTK.csproj @@ -191,7 +191,7 @@ True - ..\..\packages\System.Text.Encoding.CodePages.4.5.0\lib\net461\System.Text.Encoding.CodePages.dll + ..\..\packages\System.Text.Encoding.CodePages.4.5.1\lib\net461\System.Text.Encoding.CodePages.dll ..\..\packages\System.Threading.Tasks.Extensions.4.6.0-preview.18571.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll diff --git a/AideDeJeu/AideDeJeu.GTK/packages.config b/AideDeJeu/AideDeJeu.GTK/packages.config index 1a429450..aaaac7b4 100644 --- a/AideDeJeu/AideDeJeu.GTK/packages.config +++ b/AideDeJeu/AideDeJeu.GTK/packages.config @@ -42,7 +42,7 @@ - + diff --git a/AideDeJeu/AideDeJeu.UWP/AideDeJeu.UWP.csproj b/AideDeJeu/AideDeJeu.UWP/AideDeJeu.UWP.csproj index c23f93bd..eebb4d1a 100644 --- a/AideDeJeu/AideDeJeu.UWP/AideDeJeu.UWP.csproj +++ b/AideDeJeu/AideDeJeu.UWP/AideDeJeu.UWP.csproj @@ -221,6 +221,9 @@ 1.6.258-beta + + 4.5.1 + 1.1.0 diff --git a/AideDeJeu/AideDeJeu.iOS/AideDeJeu.iOS.csproj b/AideDeJeu/AideDeJeu.iOS/AideDeJeu.iOS.csproj index 205573d7..9f16b902 100644 --- a/AideDeJeu/AideDeJeu.iOS/AideDeJeu.iOS.csproj +++ b/AideDeJeu/AideDeJeu.iOS/AideDeJeu.iOS.csproj @@ -142,6 +142,9 @@ 1.6.258-beta + + 4.5.1 + 1.1.0 diff --git a/AideDeJeu/AideDeJeu/AideDeJeu.csproj b/AideDeJeu/AideDeJeu/AideDeJeu.csproj index 3094b921..35f9c14b 100644 --- a/AideDeJeu/AideDeJeu/AideDeJeu.csproj +++ b/AideDeJeu/AideDeJeu/AideDeJeu.csproj @@ -21,12 +21,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -38,6 +74,7 @@ + diff --git a/AideDeJeu/AideDeJeu/Pdf/AlverataIrregularPEMedium.ttf b/AideDeJeu/AideDeJeu/Pdf/AlverataIrregularPEMedium.ttf new file mode 100644 index 00000000..3689e21d Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/AlverataIrregularPEMedium.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_DR.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_DR.ttf new file mode 100644 index 00000000..591de3cf Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_DR.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_I.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_I.ttf new file mode 100644 index 00000000..684eec75 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_I.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_R.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_R.ttf new file mode 100644 index 00000000..ab154440 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_R.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RB.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RB.ttf new file mode 100644 index 00000000..049915e0 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RB.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RBI.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RBI.ttf new file mode 100644 index 00000000..82af9faa Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RBI.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RI.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RI.ttf new file mode 100644 index 00000000..a156230a Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RI.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZ.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZ.ttf new file mode 100644 index 00000000..ddf1dad9 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZ.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZI.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZI.ttf new file mode 100644 index 00000000..ed4c8fe7 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_RZI.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBL.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBL.ttf new file mode 100644 index 00000000..3469f97c Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBL.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBS.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBS.ttf new file mode 100644 index 00000000..fe3c35c6 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aBS.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aDRS.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aDRS.ttf new file mode 100644 index 00000000..388afad4 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aDRS.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aRL.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aRL.ttf new file mode 100644 index 00000000..2efae623 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aRL.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aS.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aS.ttf new file mode 100644 index 00000000..751dc8df Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aS.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSI.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSI.ttf new file mode 100644 index 00000000..9ad409b4 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSI.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSZI.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSZI.ttf new file mode 100644 index 00000000..b38d8200 Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aSZI.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aZL.ttf b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aZL.ttf new file mode 100644 index 00000000..8c04d96c Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/LinLibertine_aZL.ttf differ diff --git a/AideDeJeu/AideDeJeu/Pdf/MinionPro_It.ttf b/AideDeJeu/AideDeJeu/Pdf/MinionPro_It.ttf new file mode 100644 index 00000000..aa1711ba Binary files /dev/null and b/AideDeJeu/AideDeJeu/Pdf/MinionPro_It.ttf differ diff --git a/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacter/PlayerCharacterEditorViewModel.cs b/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacter/PlayerCharacterEditorViewModel.cs index 32632e97..c403cd45 100644 --- a/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacter/PlayerCharacterEditorViewModel.cs +++ b/AideDeJeu/AideDeJeu/ViewModels/PlayerCharacter/PlayerCharacterEditorViewModel.cs @@ -1034,9 +1034,9 @@ namespace AideDeJeu.ViewModels.PlayerCharacter return null; } - public static HashSet listFonts(PdfReader reader) + public static Dictionary listFonts(PdfReader reader) { - HashSet set = new HashSet(); + Dictionary set = new Dictionary(); //PdfReader reader = new PdfReader(src); PdfDictionary resources; for (int k = 1; k <= reader.NumberOfPages; ++k) @@ -1047,7 +1047,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter return set; } - public static void processResource(HashSet set, PdfDictionary resource) + public static void processResource(Dictionary set, PdfDictionary resource) { if (resource == null) return; @@ -1067,6 +1067,8 @@ namespace AideDeJeu.ViewModels.PlayerCharacter { font = fonts.GetAsDict(key); String name = font.GetAsName(PdfName.BASEFONT).ToString(); + var flat = resource.Keys; //.GetAsDict(PdfName.FILTER); + var dic = font.GetAsStream(PdfName.BASEFONT); if (name.Length > 8 && name[7] == '+') { name = String.Format("{0} subset ({1})", name.Substring(8), name.Substring(1, 7)); @@ -1084,7 +1086,7 @@ namespace AideDeJeu.ViewModels.PlayerCharacter else if (desc.Get(PdfName.FONTFILE3) != null) name += " (" + font.GetAsName(PdfName.SUBTYPE).ToString().Substring(1) + ") embedded"; } - set.Add(name); + set[name] = font.IndRef; } } @@ -1105,19 +1107,31 @@ namespace AideDeJeu.ViewModels.PlayerCharacter //} //pdfDoc.close(); - + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); //PdfDocument pdfDoc = new PdfDocument(new PdfWriter()); //var stream = DependencyService.Get().CreateStream("test.pdf"); var stream = new FileStream(Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "test.pdf"), FileMode.Create, FileAccess.ReadWrite); PdfReader reader = new PdfReader(AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.178_hd_01_feuille_de_perso_v1.pdf")); - var set = listFonts(reader); + var fontPath = Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, "LinLibertine_aS.ttf"); + using (var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_aS.ttf")) + { + using (var outFont = new FileStream(fontPath, FileMode.Create, FileAccess.ReadWrite)) + { + await inFont.CopyToAsync(outFont); + } + } + //var set = listFonts(reader); //var truc = findFontInPage(reader, "MinionPro-It", 1); //var fonts = BaseFont.GetDocumentFonts(reader); //var font = BaseFont.CreateFont("TMULFZ+MinionPro-It", BaseFont.WINANSI, BaseFont.EMBEDDED); //var font = findFontInForm(reader, new PdfName("MinionPro-It")); - var font = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.WINANSI, BaseFont.EMBEDDED); + FontFactory.Register(fontPath, "mafont"); + var mafont = FontFactory.GetFont("mafont", 20, iTextSharp.text.Font.BOLD); + //System.Text.Encoding.RegisterProvider(new System.Text.EncodingProvider()); + //var font = BaseFont.CreateFont("mafont", BaseFont.WINANSI, BaseFont.EMBEDDED); + var font = mafont.BaseFont; //var font = BaseFont.CreateFont(PRIndirectReference.()); //var font = findNamedFont(reader, ""); diff --git a/AideDeJeu/AideDeJeuCmd/AideDeJeuCmd.csproj b/AideDeJeu/AideDeJeuCmd/AideDeJeuCmd.csproj index 548a3400..6dc90993 100644 --- a/AideDeJeu/AideDeJeuCmd/AideDeJeuCmd.csproj +++ b/AideDeJeu/AideDeJeuCmd/AideDeJeuCmd.csproj @@ -14,6 +14,7 @@ + diff --git a/AideDeJeu/AideDeJeuUnitTest/AideDeJeuUnitTest.csproj b/AideDeJeu/AideDeJeuUnitTest/AideDeJeuUnitTest.csproj index 9e76ef4b..e1eb13cc 100644 --- a/AideDeJeu/AideDeJeuUnitTest/AideDeJeuUnitTest.csproj +++ b/AideDeJeu/AideDeJeuUnitTest/AideDeJeuUnitTest.csproj @@ -13,6 +13,7 @@ + diff --git a/AideDeJeu/AideDeJeuWeb/AideDeJeuWeb.csproj b/AideDeJeu/AideDeJeuWeb/AideDeJeuWeb.csproj index 03af8404..ac957268 100644 --- a/AideDeJeu/AideDeJeuWeb/AideDeJeuWeb.csproj +++ b/AideDeJeu/AideDeJeuWeb/AideDeJeuWeb.csproj @@ -13,6 +13,7 @@ +