RTF: add support for read/wite of underline and strikethrough attributes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32305 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-02-22 20:59:10 +00:00
parent 227381f621
commit d33f0c0c6a
13 changed files with 1461 additions and 947 deletions

View file

@ -1,3 +1,11 @@
2011-02-22 Eric Wasylishen <ewasylishen@gmail.com>
* Source/externs.m:
* Headers/AppKit/NSAttributedString.h: Add
NSStrikethroughStyleAttributeName
* TextConverters/RTF: Add support for reading and writing
underline and strikethrough.
2011-02-22 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSLayoutManager.m:

View file

@ -70,6 +70,7 @@ APPKIT_EXPORT NSString *NSObliquenessAttributeName;
APPKIT_EXPORT NSString *NSParagraphStyleAttributeName;
APPKIT_EXPORT NSString *NSShadowAttributeName;
APPKIT_EXPORT NSString *NSStrikethroughColorAttributeName;
APPKIT_EXPORT NSString *NSStrikethroughStyleAttributeName;
APPKIT_EXPORT NSString *NSStrokeColorAttributeName;
APPKIT_EXPORT NSString *NSStrokeWidthAttributeName;
APPKIT_EXPORT NSString *NSSuperscriptAttributeName;

View file

@ -507,6 +507,7 @@ NSString *NSParagraphStyleAttributeName = @"NSParagraphStyleAttributeName";
NSString *NSShadowAttributeName = @"NSShadowAttributeName";
NSString *NSStrikethroughColorAttributeName
= @"NSStrikethroughColorAttributeName";
NSString *NSStrikethroughStyleAttributeName = @"NSStrikethroughStyleAttributeName";
NSString *NSStrokeColorAttributeName = @"NSStrokeColorAttributeName";
NSString *NSStrokeWidthAttributeName = @"NSStrokeWidthAttributeName";
NSString *NSSuperscriptAttributeName = @"NSSuperscriptAttributeName";

View file

@ -29,10 +29,7 @@ BUNDLE_NAME = RTFConverter
BUNDLE_INSTALL_DIR =$(GNUSTEP_BUNDLES)/TextConverters
RTFConverter_OBJC_FILES = \
RTFConsumer.m RTFProducer.m
RTFConverter_C_FILES = \
rtfGrammar.tab.c rtfScanner.c
rtfGrammar.tab.m RTFConsumer.m RTFProducer.m rtfScanner.m
RTFConverter_PRINCIPAL_CLASS = RTFConsumer

View file

@ -22,10 +22,10 @@
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
BISON_FLAGS = -d -p GSRTF
BISON_FLAGS = -p GSRTF --output=rtfGrammar.tab.m --defines=rtfGrammar.tab.h
BISON = BISON_SIMPLE=bison.simple bison
# Rule not enabled because not every system has bison installed...
# FIXME add configure check for bison?
#rtfGrammar.tab.c: rtfGrammar.y
#rtfGrammar.tab.m: rtfGrammar.y
# $(BISON) $(BISON_FLAGS) $<

View file

@ -63,11 +63,13 @@ readString (StringContext *ctxt)
NSMutableParagraphStyle *paragraph;
NSColor *fgColour;
NSColor *bgColour;
NSColor *ulColour;
NSString *fontName;
float fontSize;
BOOL bold;
BOOL italic;
BOOL underline;
NSInteger underline;
NSInteger strikethrough;
int script;
float real_fi, real_li;
@ -76,6 +78,7 @@ readString (StringContext *ctxt)
- (NSFont*) currentFont;
- (NSNumber*) script;
- (NSNumber*) underline;
- (NSNumber*) strikethrough;
- (void) resetParagraphStyle;
- (void) resetFont;
- (void) addTab: (float)location type: (NSTextTabType)type;
@ -98,6 +101,7 @@ readString (StringContext *ctxt)
RELEASE(fontName);
RELEASE(fgColour);
RELEASE(bgColour);
RELEASE(ulColour);
[super dealloc];
}
@ -109,6 +113,7 @@ readString (StringContext *ctxt)
RETAIN(new->fontName);
RETAIN(new->fgColour);
RETAIN(new->bgColour);
RETAIN(new->ulColour);
return new;
}
@ -183,8 +188,16 @@ readString (StringContext *ctxt)
- (NSNumber*) underline
{
if (underline)
return [NSNumber numberWithInt: NSSingleUnderlineStyle];
if (underline != NSUnderlineStyleNone)
return [NSNumber numberWithInteger: underline];
else
return nil;
}
- (NSNumber*) strikethrough
{
if (strikethrough != NSUnderlineStyleNone)
return [NSNumber numberWithInteger: strikethrough];
else
return nil;
}
@ -208,10 +221,12 @@ readString (StringContext *ctxt)
italic = NO;
bold = NO;
underline = NO;
underline = NSUnderlineStyleNone;
strikethrough = NSUnderlineStyleNone;
script = 0;
DESTROY(fgColour);
DESTROY(bgColour);
DESTROY(ulColour);
changed = YES;
}
@ -636,11 +651,16 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
ps, NSParagraphStyleAttributeName,
nil];
DESTROY(ps);
if (attr->underline)
if ([attr underline])
{
[attributes setObject: [attr underline]
forKey: NSUnderlineStyleAttributeName];
}
if ([attr strikethrough])
{
[attributes setObject: [attr strikethrough]
forKey: NSStrikethroughStyleAttributeName];
}
if (attr->script)
{
[attributes setObject: [attr script]
@ -656,7 +676,12 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
[attributes setObject: attr->bgColour
forKey: NSBackgroundColorAttributeName];
}
if (attr->ulColour != nil)
{
[attributes setObject: attr->ulColour
forKey: NSUnderlineColorAttributeName];
}
[result setAttributes: attributes
range: NSMakeRange(oldPosition, textlen)];
DESTROY(attributes);
@ -764,8 +789,10 @@ static BOOL classInheritsFromNSMutableAttributedString (Class c)
#define ITALIC CTXT->italic
#define BOLD CTXT->bold
#define UNDERLINE CTXT->underline
#define STRIKETHROUGH CTXT->strikethrough
#define FGCOLOUR CTXT->fgColour
#define BGCOLOUR CTXT->bgColour
#define ULCOLOUR CTXT->ulColour
#define PAPERSIZE @"PaperSize"
#define LEFTMARGIN @"LeftMargin"
@ -1183,6 +1210,19 @@ void GSRTFcolorfg (void *ctxt, int color)
CHANGED = YES;
}
void GSRTFunderlinecolor (void *ctxt, int color)
{
if ([COLOURS count] <= (unsigned int)color)
{
ASSIGN (ULCOLOUR, [NSColor blackColor]);
}
else
{
ASSIGN (ULCOLOUR, [COLOURS objectAtIndex: color]);
}
CHANGED = YES;
}
void GSRTFsubscript (void *ctxt, int script)
{
script = (int) (-halfpoints2points(script) / 3.0);
@ -1223,11 +1263,36 @@ void GSRTFbold (void *ctxt, BOOL state)
}
}
void GSRTFunderline (void *ctxt, BOOL state)
void GSRTFunderline (void *ctxt, BOOL state, NSInteger style)
{
if (state != UNDERLINE)
if (state == NO)
{
UNDERLINE = state;
style = NSUnderlineStyleNone;
}
if (UNDERLINE != style)
{
UNDERLINE = style;
CHANGED = YES;
}
}
void GSRTFstrikethrough (void *ctxt, NSInteger style)
{
if (STRIKETHROUGH != style)
{
STRIKETHROUGH = style;
CHANGED = YES;
}
}
void GSRTFstrikethroughDouble (void *ctxt)
{
const NSInteger style = NSUnderlineStyleDouble | NSUnderlinePatternSolid;
if (STRIKETHROUGH != style)
{
STRIKETHROUGH = style;
CHANGED = YES;
}
}

View file

@ -121,6 +121,8 @@ void GSRTFaddDefaultColor(void *ctxt);
void GSRTFcolorbg(void *ctxt, int color);
/* set foreground colour */
void GSRTFcolorfg(void *ctxt, int color);
/* set underline colour */
void GSRTFunderlinecolor(void *ctxt, int color);
/* set default character style */
void GSRTFdefaultCharacterStyle(void *ctxt);
/* set subscript in half points */
@ -131,8 +133,10 @@ void GSRTFsuperscript(void *ctxt, int script);
void GSRTFbold(void *ctxt, BOOL on);
/* Switch italic mode on or off */
void GSRTFitalic(void *ctxt, BOOL on);
/* Switch underline mode on or off */
void GSRTFunderline(void *ctxt, BOOL on);
/* Set the underline style */
void GSRTFunderline(void *ctxt, BOOL on, NSInteger style);
/* Set the strikethrough style */
void GSRTFstrikethrough(void *ctxt, NSInteger style);
/* new paragraph */
void GSRTFparagraph(void *ctxt);
/* NeXTGraphic */

View file

@ -52,6 +52,7 @@
NSColor *fgColor;
NSColor *bgColor;
NSColor *ulColor;
NSDictionary *_attributesOfLastRun; /*" holds the attributes of the last run
to build the delta "*/

View file

@ -148,6 +148,7 @@
ASSIGN(fgColor, [NSColor textColor]);
ASSIGN(bgColor, [NSColor textBackgroundColor]);
ASSIGN(ulColor, [NSColor textColor]);
return self;
}
@ -162,6 +163,7 @@
RELEASE(fgColor);
RELEASE(bgColor);
RELEASE(ulColor);
RELEASE(_attributesOfLastRun);
@ -872,9 +874,72 @@
(short)[self numberForColor: color]];
}
}
else if ([attributeName isEqualToString: NSUnderlineColorAttributeName])
{
NSColor *color = [attributesToAdd objectForKey:
NSUnderlineColorAttributeName];
[result appendFormat: @"\\ulc%d",
(short)[self numberForColor: color]];
}
else if ([attributeName isEqualToString: NSUnderlineStyleAttributeName])
{
[result appendString: @"\\ul"];
NSInteger styleMask = [[attributesToAdd objectForKey: NSUnderlineStyleAttributeName] integerValue];
if ((styleMask & NSUnderlineByWordMask) == NSUnderlineByWordMask)
{
[result appendString: @"\\ulw"];
}
else if ((styleMask & NSUnderlineStyleDouble) == NSUnderlineStyleDouble)
{
[result appendString: @"\\uldb"];
}
else if ((styleMask & NSUnderlineStyleThick) == NSUnderlineStyleThick)
{
if ((styleMask & NSUnderlinePatternDot) == NSUnderlinePatternDot)
{
[result appendString: @"\\ulthd"];
}
else if ((styleMask & NSUnderlinePatternDash) == NSUnderlinePatternDash)
{
[result appendString: @"\\ulthdash"];
}
else if ((styleMask & NSUnderlinePatternDashDot) == NSUnderlinePatternDashDot)
{
[result appendString: @"\\ulthdashd"];
}
else if ((styleMask & NSUnderlinePatternDashDotDot) == NSUnderlinePatternDashDotDot)
{
[result appendString: @"\\ulthdashdd"];
}
else // Assume NSUnderlinePatternSolid
{
[result appendString: @"\\ulth"];
}
}
else // Assume NSUnderlineStyleSingle
{
if ((styleMask & NSUnderlinePatternDot) == NSUnderlinePatternDot)
{
[result appendString: @"\\uld"];
}
else if ((styleMask & NSUnderlinePatternDash) == NSUnderlinePatternDash)
{
[result appendString: @"\\uldash"];
}
else if ((styleMask & NSUnderlinePatternDashDot) == NSUnderlinePatternDashDot)
{
[result appendString: @"\\uldashd"];
}
else if ((styleMask & NSUnderlinePatternDashDotDot) == NSUnderlinePatternDashDotDot)
{
[result appendString: @"\\uldashdd"];
}
else // Assume NSUnderlinePatternSolid
{
[result appendString: @"\\ul"];
}
}
}
else if ([attributeName isEqualToString: NSSuperscriptAttributeName])
{

View file

@ -1,24 +1,23 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -29,10 +28,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@ -72,157 +72,94 @@
RTFblue = 288,
RTFcolorbg = 289,
RTFcolorfg = 290,
RTFcolortable = 291,
RTFfont = 292,
RTFfontSize = 293,
RTFNeXTGraphic = 294,
RTFNeXTGraphicWidth = 295,
RTFNeXTGraphicHeight = 296,
RTFNeXTHelpLink = 297,
RTFNeXTHelpMarker = 298,
RTFNeXTfilename = 299,
RTFNeXTmarkername = 300,
RTFNeXTlinkFilename = 301,
RTFNeXTlinkMarkername = 302,
RTFpaperWidth = 303,
RTFpaperHeight = 304,
RTFmarginLeft = 305,
RTFmarginRight = 306,
RTFmarginTop = 307,
RTFmarginButtom = 308,
RTFfirstLineIndent = 309,
RTFleftIndent = 310,
RTFrightIndent = 311,
RTFalignCenter = 312,
RTFalignJustified = 313,
RTFalignLeft = 314,
RTFalignRight = 315,
RTFlineSpace = 316,
RTFspaceAbove = 317,
RTFstyle = 318,
RTFbold = 319,
RTFitalic = 320,
RTFunderline = 321,
RTFunderlineStop = 322,
RTFunichar = 323,
RTFsubscript = 324,
RTFsuperscript = 325,
RTFtabstop = 326,
RTFfcharset = 327,
RTFfprq = 328,
RTFcpg = 329,
RTFOtherStatement = 330,
RTFfontListStart = 331,
RTFfamilyNil = 332,
RTFfamilyRoman = 333,
RTFfamilySwiss = 334,
RTFfamilyModern = 335,
RTFfamilyScript = 336,
RTFfamilyDecor = 337,
RTFfamilyTech = 338
RTFunderlinecolor = 291,
RTFcolortable = 292,
RTFfont = 293,
RTFfontSize = 294,
RTFNeXTGraphic = 295,
RTFNeXTGraphicWidth = 296,
RTFNeXTGraphicHeight = 297,
RTFNeXTHelpLink = 298,
RTFNeXTHelpMarker = 299,
RTFNeXTfilename = 300,
RTFNeXTmarkername = 301,
RTFNeXTlinkFilename = 302,
RTFNeXTlinkMarkername = 303,
RTFpaperWidth = 304,
RTFpaperHeight = 305,
RTFmarginLeft = 306,
RTFmarginRight = 307,
RTFmarginTop = 308,
RTFmarginButtom = 309,
RTFfirstLineIndent = 310,
RTFleftIndent = 311,
RTFrightIndent = 312,
RTFalignCenter = 313,
RTFalignJustified = 314,
RTFalignLeft = 315,
RTFalignRight = 316,
RTFlineSpace = 317,
RTFspaceAbove = 318,
RTFstyle = 319,
RTFbold = 320,
RTFitalic = 321,
RTFunderline = 322,
RTFunderlineDot = 323,
RTFunderlineDash = 324,
RTFunderlineDashDot = 325,
RTFunderlineDashDotDot = 326,
RTFunderlineDouble = 327,
RTFunderlineStop = 328,
RTFunderlineThick = 329,
RTFunderlineThickDot = 330,
RTFunderlineThickDash = 331,
RTFunderlineThickDashDot = 332,
RTFunderlineThickDashDotDot = 333,
RTFunderlineWord = 334,
RTFstrikethrough = 335,
RTFstrikethroughDouble = 336,
RTFunichar = 337,
RTFsubscript = 338,
RTFsuperscript = 339,
RTFtabstop = 340,
RTFfcharset = 341,
RTFfprq = 342,
RTFcpg = 343,
RTFOtherStatement = 344,
RTFfontListStart = 345,
RTFfamilyNil = 346,
RTFfamilyRoman = 347,
RTFfamilySwiss = 348,
RTFfamilyModern = 349,
RTFfamilyScript = 350,
RTFfamilyDecor = 351,
RTFfamilyTech = 352
};
#endif
/* Tokens. */
#define RTFtext 258
#define RTFstart 259
#define RTFansi 260
#define RTFmac 261
#define RTFpc 262
#define RTFpca 263
#define RTFignore 264
#define RTFinfo 265
#define RTFstylesheet 266
#define RTFfootnote 267
#define RTFheader 268
#define RTFfooter 269
#define RTFpict 270
#define RTFplain 271
#define RTFparagraph 272
#define RTFdefaultParagraph 273
#define RTFrow 274
#define RTFcell 275
#define RTFtabulator 276
#define RTFemdash 277
#define RTFendash 278
#define RTFemspace 279
#define RTFenspace 280
#define RTFbullet 281
#define RTFlquote 282
#define RTFrquote 283
#define RTFldblquote 284
#define RTFrdblquote 285
#define RTFred 286
#define RTFgreen 287
#define RTFblue 288
#define RTFcolorbg 289
#define RTFcolorfg 290
#define RTFcolortable 291
#define RTFfont 292
#define RTFfontSize 293
#define RTFNeXTGraphic 294
#define RTFNeXTGraphicWidth 295
#define RTFNeXTGraphicHeight 296
#define RTFNeXTHelpLink 297
#define RTFNeXTHelpMarker 298
#define RTFNeXTfilename 299
#define RTFNeXTmarkername 300
#define RTFNeXTlinkFilename 301
#define RTFNeXTlinkMarkername 302
#define RTFpaperWidth 303
#define RTFpaperHeight 304
#define RTFmarginLeft 305
#define RTFmarginRight 306
#define RTFmarginTop 307
#define RTFmarginButtom 308
#define RTFfirstLineIndent 309
#define RTFleftIndent 310
#define RTFrightIndent 311
#define RTFalignCenter 312
#define RTFalignJustified 313
#define RTFalignLeft 314
#define RTFalignRight 315
#define RTFlineSpace 316
#define RTFspaceAbove 317
#define RTFstyle 318
#define RTFbold 319
#define RTFitalic 320
#define RTFunderline 321
#define RTFunderlineStop 322
#define RTFunichar 323
#define RTFsubscript 324
#define RTFsuperscript 325
#define RTFtabstop 326
#define RTFfcharset 327
#define RTFfprq 328
#define RTFcpg 329
#define RTFOtherStatement 330
#define RTFfontListStart 331
#define RTFfamilyNil 332
#define RTFfamilyRoman 333
#define RTFfamilySwiss 334
#define RTFfamilyModern 335
#define RTFfamilyScript 336
#define RTFfamilyDecor 337
#define RTFfamilyTech 338
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 81 "rtfGrammar.y"
{
/* Line 1676 of yacc.c */
#line 82 "rtfGrammar.y"
int number;
const char *text;
RTFcmd cmd;
}
/* Line 1529 of yacc.c. */
#line 221 "rtfGrammar.tab.h"
YYSTYPE;
/* Line 1676 of yacc.c */
#line 157 "rtfGrammar.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif

View file

@ -53,6 +53,7 @@
first place.
*/
#import <AppKit/AppKit.h>
#include <stdlib.h>
#include <string.h>
#include "rtfScanner.h"
@ -118,6 +119,7 @@ int GSRTFlex(void *lvalp, void *lctxt);
%token <cmd> RTFblue
%token <cmd> RTFcolorbg
%token <cmd> RTFcolorfg
%token <cmd> RTFunderlinecolor
%token <cmd> RTFcolortable
%token <cmd> RTFfont
%token <cmd> RTFfontSize
@ -149,7 +151,20 @@ int GSRTFlex(void *lvalp, void *lctxt);
%token <cmd> RTFbold
%token <cmd> RTFitalic
%token <cmd> RTFunderline
%token <cmd> RTFunderlineDot
%token <cmd> RTFunderlineDash
%token <cmd> RTFunderlineDashDot
%token <cmd> RTFunderlineDashDotDot
%token <cmd> RTFunderlineDouble
%token <cmd> RTFunderlineStop
%token <cmd> RTFunderlineThick
%token <cmd> RTFunderlineThickDot
%token <cmd> RTFunderlineThickDash
%token <cmd> RTFunderlineThickDashDot
%token <cmd> RTFunderlineThickDashDotDot
%token <cmd> RTFunderlineWord
%token <cmd> RTFstrikethrough
%token <cmd> RTFstrikethroughDouble
%token <cmd> RTFunichar
%token <cmd> RTFsubscript
%token <cmd> RTFsuperscript
@ -325,6 +340,13 @@ rtfStatement: RTFfont { int font;
else
color = $1.parameter;
GSRTFcolorfg(CTXT, color); }
| RTFunderlinecolor { int color;
if ($1.isEmpty)
color = 0;
else
color = $1.parameter;
GSRTFunderlinecolor(CTXT, color); }
| RTFsubscript { int script;
if ($1.isEmpty)
@ -359,8 +381,92 @@ rtfStatement: RTFfont { int font;
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on); }
| RTFunderlineStop { GSRTFunderline(CTXT, NO); }
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternSolid); }
| RTFunderlineDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternDot); }
| RTFunderlineDash { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternDash); }
| RTFunderlineDashDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternDashDot); }
| RTFunderlineDashDotDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternDashDotDot); }
| RTFunderlineDouble { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleDouble | NSUnderlinePatternSolid); }
| RTFunderlineStop { GSRTFunderline(CTXT, NO, NSUnderlineStyleNone); }
| RTFunderlineThick { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleThick | NSUnderlinePatternSolid); }
| RTFunderlineThickDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleThick | NSUnderlinePatternDot); }
| RTFunderlineThickDash { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleThick | NSUnderlinePatternDash); }
| RTFunderlineThickDashDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleThick | NSUnderlinePatternDashDot); }
| RTFunderlineThickDashDotDot { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleThick | NSUnderlinePatternDashDotDot); }
| RTFunderlineWord { BOOL on;
if ($1.isEmpty || $1.parameter)
on = YES;
else
on = NO;
GSRTFunderline(CTXT, on, NSUnderlineStyleSingle | NSUnderlinePatternSolid | NSUnderlineByWordMask); }
| RTFstrikethrough { NSInteger style;
if ($1.isEmpty || $1.parameter)
style = NSUnderlineStyleSingle | NSUnderlinePatternSolid;
else
style = NSUnderlineStyleNone;
GSRTFstrikethrough(CTXT, style); }
| RTFstrikethroughDouble { GSRTFstrikethrough(CTXT, NSUnderlineStyleDouble | NSUnderlinePatternSolid); }
| RTFunichar { GSRTFunicode(CTXT, $1.parameter); }
| RTFplain { GSRTFdefaultCharacterStyle(CTXT); }
| RTFparagraph { GSRTFparagraph(CTXT); }

View file

@ -237,16 +237,26 @@ LexKeyword RTFcommands[] =
{"s", token(RTFstyle)},
{"sa", token(RTFspaceAbove)},
{"sl", token(RTFlineSpace)},
{"strike", token(RTFstrikethrough)},
{"striked1", token(RTFstrikethroughDouble)},
{"stylesheet",token(RTFstylesheet)},
{"tab", token(RTFtabulator)},
{"tx", token(RTFtabstop)},
{"u", token(RTFunichar)},
/* All underline are mapped on one entry */
{"ul", token(RTFunderline)},
{"uld", token(RTFunderline)},
{"uldb", token(RTFunderline)},
{"ulc", token(RTFunderlinecolor)},
{"uld", token(RTFunderlineDot)},
{"uldash", token(RTFunderlineDash)},
{"uldashd", token(RTFunderlineDashDot)},
{"uldashdd", token(RTFunderlineDashDotDot)},
{"uldb", token(RTFunderlineDouble)},
{"ulnone", token(RTFunderlineStop)},
{"ulw", token(RTFunderline)},
{"ulth", token(RTFunderlineThick)},
{"ulthd", token(RTFunderlineThickDot)},
{"ulthdash", token(RTFunderlineThickDash)},
{"ulthdashd", token(RTFunderlineThickDashDot)},
{"ulthdashdd",token(RTFunderlineThickDashDotDot)},
{"ulw", token(RTFunderlineWord)},
{"up", token(RTFsuperscript)},
{"width", token(RTFNeXTGraphicWidth)}
};