Curl Global Community
Protected Text - Printable Version

+- Curl Global Community (
+-- Forum: Blogs (
+--- Forum: Tech blog (
+---- Forum: Robert blog (
+---- 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"}
|| 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
set inspect? = true
{if not inspect? then
|| {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
\u0020 {br}

} || 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