Curl Global Community
Protected Text - Printable Version

+- Curl Global Community (https://communities.curl.com)
+-- Forum: Blogs (https://communities.curl.com/forumdisplay.php?fid=17)
+--- Forum: Tech blog (https://communities.curl.com/forumdisplay.php?fid=18)
+---- Forum: Robert blog (https://communities.curl.com/forumdisplay.php?fid=20)
+---- Thread: Protected Text (/showthread.php?tid=302)



Protected Text - RobertShiplett - 10-11-2011

I have a standard header for simple text pages that I wish to protect from copy and paste. Most often the issue is copyright outside the USA. A more complex header is needed when styles and macros are required, but ost of these texts ate wrapped in a simple {pre }. Suggestions, anyone? In the absence of additional code, there is no suspend or resume, for example.

{curl 8.0 applet}
{curl-file-attributes character-encoding="utf8"}
{applet
|| manifest = "NO-manifest.mcurl",
{compiler-directives careful? = true}
}
{document-style DefaultDocument}
{set-document-properties background= {Background.from-string "linen"}}

{title heading?=false, BROWSER TITLE }

{let inspect?:bool} || SET THIS FLAG AS NEEDED
{if-debuggable
set inspect? = true
}
{if not inspect? then
{disable-inspection-gesture}
}
|| {include "", "" }
{TextFlowBox text-selectable? = inspect?, paragraph-left-indent=8pt,
{on ae:AttachEvent do
{if not inspect? then
set ae.root-frame.context-menu-for-view = null
}
},
{paragraph
\u0020 {br}
{pre
\u0020

TEXT GOES HERE
} || pre
} || para
} || TFB
|| eof text ln nnn ------------------------------------

The forced space at the start of the {pre } ensures that, if the first line of the text is centred, the first line will display as intended. The quirk is apparent at least in Firefox 3 on Ubuntu maverick.


Note on fonts: when using {pre } it will not help to set font properties in the TextFlowBox. The following works:
{pre font-family="serif",font-size=10pt,
or to replace this with
{paragraph text-preserve-whitespace?=false,
and then control font in one place from the TextFlowBox