// COMPLETE
namespace System.Windows.Forms.RTF {
- internal class Font {
+
+#if RTF_LIB
+ public
+#else
+ internal
+#endif
+ class Font {
#region Local Variables
private string name;
private string alt_name;
private int type;
private int codepage;
private Font next;
+ private RTF rtf;
#endregion // Local Variables
#region Constructors
public Font(RTF rtf) {
+ this.rtf = rtf;
num = -1;
+ name = String.Empty;
lock (rtf) {
if (rtf.Fonts == null)
}
set {
+ // Whack any previous font with the same number
+ DeleteFont(rtf, value);
num = value;
}
}
#endregion // Properties
#region Methods
+ static public bool DeleteFont(RTF rtf, int font_number) {
+ Font f;
+ Font prev;
+
+ lock (rtf) {
+ f = rtf.Fonts;
+ prev = null;
+ while ((f != null) && (f.num != font_number)) {
+ prev = f;
+ f = f.next;
+ }
+
+ if (f != null) {
+ if (f == rtf.Fonts) {
+ rtf.Fonts = f.next;
+ } else {
+ if (prev != null) {
+ prev.next = f.next;
+ } else {
+ rtf.Fonts = f.next;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
static public Font GetFont(RTF rtf, int font_number) {
Font f;