NanoXLSX.Formatting 3.0.0
Loading...
Searching...
No Matches
PhoneticProperties.cs
1/*
2 * NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3 * Copyright Raphael Stoeckli © 2026
4 * This library is licensed under the MIT License.
5 * You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6 */
7
8using System.Collections.Generic;
9using NanoXLSX.Styles;
10
11namespace NanoXLSX.Extensions
12{
16 public class PhoneticProperties
17 {
21 public Font FontReference { get; set; }
26 public int FontId { get; set; }
30 public PhoneticRun.PhoneticType Type { get; set; } = PhoneticRun.PhoneticType.FullwidthKatakana;
35
40 public PhoneticProperties(Font fontReference)
41 {
42 FontReference = fontReference; // Validation will be performed when XLSX file is generated
43 }
44
50 {
52 {
53 Type = this.Type,
54 Alignment = this.Alignment
55 };
56 }
57
63 public override bool Equals(object obj)
64 {
65 if (!(obj is PhoneticProperties properties)) { return false; }
66 return ((FontReference == null && properties.FontReference == null) ||
67 (FontReference != null && FontReference.Equals(properties.FontReference))) &&
68 Type == properties.Type &&
69 Alignment == properties.Alignment;
70 }
71
76 public override int GetHashCode()
77 {
78 var hashCode = 136542229;
79 hashCode = hashCode * -1521134295 + EqualityComparer<Font>.Default.GetHashCode(FontReference);
80 hashCode = hashCode * -1521134295 + Type.GetHashCode();
81 hashCode = hashCode * -1521134295 + Alignment.GetHashCode();
82 return hashCode;
83 }
84 }
85}
PhoneticProperties(Font fontReference)
Default constructor to create phonetic properties, using the specified font reference.
PhoneticRun.PhoneticType Type
The type of phonetic text representation. Default is FullwidthKatakana.
int FontId
Internal Id of the font used for phonetic text.
Font FontReference
Font reference that is used to render the Ruby text.
override int GetHashCode()
HashCode override for phonetic properties.
PhoneticRun.PhoneticAlignment Alignment
Alignment of the phonetic text relative to the base text. Default is Left.
override bool Equals(object obj)
Equals override to compare phonetic properties.
PhoneticProperties Copy()
Creates a copy of the current phonetic properties.
Represents a phonetic run that provides pronunciation guidance for text.
PhoneticAlignment
Enumeration for phonetic text alignment.
PhoneticType
Enumeration for phonetic text types.