mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-26 17:49:21 +00:00
Add outline and shadow to IIgs doc conversion
RTF includes outline and shadow styles, but for some reason CiderPress wasn't generating them. They don't appear in the Rich Text Edit file viewer, but if you extract the file and open it with Microsoft Word you can see the text in all its glory.
This commit is contained in:
parent
cc93d4ab92
commit
f6601161fe
@ -682,6 +682,46 @@ void ReformatText::RTFUnderlineOff(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ReformatText::RTFOutlineOn(void)
|
||||
{
|
||||
if (fOutlineEnabled)
|
||||
return;
|
||||
if (fUseRTF) {
|
||||
BufPrintf("\\outl ");
|
||||
fOutlineEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ReformatText::RTFOutlineOff(void)
|
||||
{
|
||||
if (!fOutlineEnabled)
|
||||
return;
|
||||
if (fUseRTF) {
|
||||
BufPrintf("\\outl0 ");
|
||||
fOutlineEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ReformatText::RTFShadowOn(void)
|
||||
{
|
||||
if (fShadowEnabled)
|
||||
return;
|
||||
if (fUseRTF) {
|
||||
BufPrintf("\\shad ");
|
||||
fShadowEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ReformatText::RTFShadowOff(void)
|
||||
{
|
||||
if (!fShadowEnabled)
|
||||
return;
|
||||
if (fUseRTF) {
|
||||
BufPrintf("\\shad0 ");
|
||||
fShadowEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ReformatText::RTFSubscriptOn(void)
|
||||
{
|
||||
if (fSubscriptEnabled)
|
||||
@ -871,7 +911,7 @@ void ReformatText::RTFSetGSFont(uint16_t family)
|
||||
newMult = 1.5f;
|
||||
break;
|
||||
default:
|
||||
LOGI("Unrecognized font family 0x%04x", family);
|
||||
LOGI("Unrecognized font family 0x%04x, using Arial", family);
|
||||
RTFSetFont(kFontArial);
|
||||
newMult = 1.0f;
|
||||
break;
|
||||
@ -897,11 +937,11 @@ void ReformatText::RTFSetGSFontSize(int points)
|
||||
}
|
||||
|
||||
/*
|
||||
* Set bold/italic/underline. "Teach" ignores you if you try to
|
||||
* underline text smaller than 8 points, but if you leave the mode
|
||||
* on from a previous block it will act like it wants to underline
|
||||
* text but not actually do it. We have to emulate this behavior,
|
||||
* or some documents (e.g. "MZ.MANUAL") look terrible.
|
||||
* Set bold/italic/underline etc.
|
||||
*
|
||||
* Note that "Teach" does not show underlining on text that is 8 points
|
||||
* or smaller. We have to emulate this behavior or some documents, such
|
||||
* as ModZap's "MZ.Manual", look terrible.
|
||||
*
|
||||
* Set the font size before calling here.
|
||||
*
|
||||
@ -914,26 +954,41 @@ void ReformatText::RTFSetGSFontStyle(uint8_t qdStyle)
|
||||
if (!fUseRTF)
|
||||
return;
|
||||
|
||||
if ((qdStyle & kQDStyleBold) != 0)
|
||||
if ((qdStyle & kQDStyleBold) != 0) {
|
||||
RTFBoldOn();
|
||||
else
|
||||
} else {
|
||||
RTFBoldOff();
|
||||
if ((qdStyle & kQDStyleItalic) != 0)
|
||||
}
|
||||
if ((qdStyle & kQDStyleItalic) != 0) {
|
||||
RTFItalicOn();
|
||||
else
|
||||
} else {
|
||||
RTFItalicOff();
|
||||
if ((qdStyle & kQDStyleUnderline) != 0 && fPreMultPointSize > 8)
|
||||
}
|
||||
if ((qdStyle & kQDStyleUnderline) != 0 && fPreMultPointSize > 8) {
|
||||
RTFUnderlineOn();
|
||||
else
|
||||
} else {
|
||||
RTFUnderlineOff();
|
||||
if ((qdStyle & kQDStyleSuperscript) != 0)
|
||||
}
|
||||
if ((qdStyle & kQDStyleOutline) != 0) {
|
||||
RTFOutlineOn();
|
||||
} else {
|
||||
RTFOutlineOff();
|
||||
}
|
||||
if ((qdStyle & kQDStyleShadow) != 0) {
|
||||
RTFShadowOn();
|
||||
} else {
|
||||
RTFShadowOff();
|
||||
}
|
||||
if ((qdStyle & kQDStyleSuperscript) != 0) {
|
||||
RTFSuperscriptOn();
|
||||
else
|
||||
} else {
|
||||
RTFSuperscriptOff();
|
||||
if ((qdStyle & kQDStyleSubscript) != 0)
|
||||
}
|
||||
if ((qdStyle & kQDStyleSubscript) != 0) {
|
||||
RTFSubscriptOn();
|
||||
else
|
||||
} else {
|
||||
RTFSubscriptOff();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -180,23 +180,29 @@ private:
|
||||
*/
|
||||
class ReformatText : public Reformat {
|
||||
public:
|
||||
typedef enum ParagraphJustify {
|
||||
enum ParagraphJustify {
|
||||
kJustifyLeft,
|
||||
kJustifyRight,
|
||||
kJustifyCenter,
|
||||
kJustifyFull,
|
||||
} ParagraphJustify;
|
||||
|
||||
ReformatText(void) {
|
||||
fUseRTF = true;
|
||||
fLeftMargin = fRightMargin = 0;
|
||||
fPointSize = fPreMultPointSize = 8;
|
||||
fGSFontSizeMult = 1.0;
|
||||
fJustified = kJustifyLeft;
|
||||
fBoldEnabled = fItalicEnabled = fUnderlineEnabled =
|
||||
fSuperscriptEnabled = fSubscriptEnabled = false;
|
||||
fTextColor = kColorNone;
|
||||
};
|
||||
|
||||
ReformatText()
|
||||
: fLeftMargin(0),
|
||||
fRightMargin(0),
|
||||
fPointSize(8),
|
||||
fPreMultPointSize(8),
|
||||
fGSFontSizeMult(1.0),
|
||||
fBoldEnabled(false),
|
||||
fItalicEnabled(false),
|
||||
fUnderlineEnabled(false),
|
||||
fOutlineEnabled(false),
|
||||
fShadowEnabled(false),
|
||||
fSuperscriptEnabled(false),
|
||||
fSubscriptEnabled(false),
|
||||
fJustified(kJustifyLeft),
|
||||
fTextColor(kColorNone)
|
||||
{}
|
||||
virtual ~ReformatText(void) {}
|
||||
|
||||
/*
|
||||
@ -308,16 +314,19 @@ protected:
|
||||
void RTFParaRight(void);
|
||||
void RTFParaCenter(void);
|
||||
void RTFParaJustify(void);
|
||||
void RTFLeftMargin(int margin);
|
||||
void RTFRightMargin(int margin);
|
||||
//void RTFSetMargins(void);
|
||||
void RTFSubscriptOn(void);
|
||||
void RTFSubscriptOff(void);
|
||||
void RTFSuperscriptOn(void);
|
||||
void RTFSuperscriptOff(void);
|
||||
void RTFOutlineOn(void);
|
||||
void RTFOutlineOff(void);
|
||||
void RTFShadowOn(void);
|
||||
void RTFShadowOff(void);
|
||||
void RTFSetColor(TextColor color);
|
||||
void RTFSetFont(RTFFont font);
|
||||
void RTFSetFontSize(int points);
|
||||
void RTFLeftMargin(int margin);
|
||||
void RTFRightMargin(int margin);
|
||||
void RTFSetGSFont(uint16_t family);
|
||||
void RTFSetGSFontSize(int points);
|
||||
void RTFSetGSFontStyle(uint8_t qdStyle);
|
||||
@ -404,6 +413,8 @@ private:
|
||||
bool fBoldEnabled;
|
||||
bool fItalicEnabled;
|
||||
bool fUnderlineEnabled;
|
||||
bool fOutlineEnabled;
|
||||
bool fShadowEnabled;
|
||||
bool fSuperscriptEnabled;
|
||||
bool fSubscriptEnabled;
|
||||
ParagraphJustify fJustified;
|
||||
|
Loading…
Reference in New Issue
Block a user