mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Make the Diacritics class public for use in external StreamProcessors
This commit is contained in:
@@ -278,6 +278,7 @@
|
||||
"UglyToad.PdfPig.Util.DefaultWordExtractor",
|
||||
"UglyToad.PdfPig.Util.DateFormatHelper",
|
||||
"UglyToad.PdfPig.Util.DictionaryTokenExtensions",
|
||||
"UglyToad.PdfPig.Util.Diacritics",
|
||||
"UglyToad.PdfPig.Util.WhitespaceSizeStatistics",
|
||||
"UglyToad.PdfPig.Writer.ITokenWriter",
|
||||
"UglyToad.PdfPig.Writer.PdfAStandard",
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
|
||||
internal static class Diacritics
|
||||
/// <summary>
|
||||
/// Helper class for diacritics.
|
||||
/// </summary>
|
||||
public static class Diacritics
|
||||
{
|
||||
private static readonly HashSet<string> NonCombiningDiacritics =
|
||||
[
|
||||
@@ -21,8 +24,21 @@
|
||||
"¸"
|
||||
];
|
||||
|
||||
public static bool IsPotentialStandaloneDiacritic(string value) => NonCombiningDiacritics.Contains(value);
|
||||
internal static bool IsPotentialStandaloneDiacritic(string value) => NonCombiningDiacritics.Contains(value);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified string contains a single character
|
||||
/// that falls within the Unicode combining diacritic range (U+0300 to U+036F).
|
||||
/// </summary>
|
||||
/// <param name="value">The string to check. It should contain exactly one character.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the character in the string is within the combining diacritic range;
|
||||
/// otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// This method is useful for identifying characters that are typically used as
|
||||
/// combining diacritics in Unicode text.
|
||||
/// </remarks>
|
||||
public static bool IsInCombiningDiacriticRange(string value)
|
||||
{
|
||||
if (value.Length != 1)
|
||||
@@ -40,6 +56,19 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to combine a diacritic character with the preceding letter to form a single combined character.
|
||||
/// </summary>
|
||||
/// <param name="diacritic">The diacritic character to combine.</param>
|
||||
/// <param name="previous">The preceding letter to combine with the diacritic.</param>
|
||||
/// <param name="result">
|
||||
/// When this method returns, contains the combined character if the combination was successful;
|
||||
/// otherwise, <see langword="null"/>.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <see langword="true"/> if the diacritic was successfully combined with the preceding letter;
|
||||
/// otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
public static bool TryCombineDiacriticWithPreviousLetter(string diacritic, string previous, [NotNullWhen(true)] out string? result)
|
||||
{
|
||||
result = null;
|
||||
|
||||
Reference in New Issue
Block a user