Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ con GTK4 y ha terminado siendo algo que uso de verdad para borradores y notas.
- **Exportar a PDF** (Ctrl+P): imprime o exporta el documento a través del
pipeline de impresión de GTK, reutilizando el mismo análisis de tramos y
adornos del editor. Las cabeceras, los bloques de código, las citas y las
tablas se tematizan, con ajustes de exportación separados (esquema de color,
fuentes, tamaño de página y orientación) y una paginación cuidadosa (sin
tablas se tematizan, y la maquetación se elige con plantillas de página
(Artículo, Manuscrito, Carta, Compacta o Personalizada), temas de hoja de
estilo y, si hace falta, un CSS propio. La paginación es cuidadosa (sin
cabeceras huérfanas, soporte de `\newpage`).
- **Vista previa de impresión**: la misma maquetación del PDF, paginada, antes
de imprimir.
- **Archivos**: abrir, guardar y guardar como con `GtkFileDialog`, escritura
atómica, aviso de cambios sin guardar y autoguardado configurable.
- **Barra lateral** (F9) con documentos recientes filtrables e índice del
Expand Down Expand Up @@ -162,6 +165,49 @@ se encogen en vez de ocultarse: el glifo diminuto sigue en la maquetación de
GTK, así que el camino del aborto por texto invisible de GNOME/gtk#8346 queda
inalcanzable por construcción.

## Plantillas, temas y hojas de estilo

El aspecto del PDF se decide en dos capas que se suman. La **plantilla** fija la
geometría: márgenes, interlineado, escala de cabeceras, cabecera y pie con
numeración, y bloque de título a partir del nombre del documento. El **tema**
fija tipografía y color. Cualquier tema se combina con cualquier plantilla.

| Plantilla | Para qué |
| --- | --- |
| Personalizada | Usa los ajustes granulares de Preferencias |
| Artículo | La maquetación de siempre |
| Manuscrito | Serif, interlineado doble, márgenes de una pulgada, cabecera con el título y pie con número de página |
| Carta | Sin bloque de título, márgenes ajustados y pie con número de página |
| Compacta | Notas técnicas, espaciado apretado |

| Tema | Qué hace |
| --- | --- |
| Ninguno | Deja la plantilla tal cual |
| Sepia | Papel crema, serif cálida, interlineado amplio y cabeceras grandes para leer mucho rato |
| Alto contraste | Texto sans más grande, negro sobre blanco y enlaces azules, para imprimir |
| Técnico | Todo monoespaciado, espaciado apretado y cabeceras azul marino, para notas y código |
| Académico | Serif de 11 pt con interlineado doble y cabeceras discretas, como una página de journal |

La fila **Hoja de estilo** del mismo grupo carga un CSS del disco que se aplica
**encima** del tema, así que puede corregir un solo detalle. El analizador es un subconjunto
mapeado, no un motor CSS: el export pinta y pagina con cairo, de modo que cada
declaración se traduce a un valor que la maquetación ya entiende y lo que queda
fuera se ignora con un aviso. Quitar el fichero o elegir Ninguno devuelve la
salida anterior tal cual.

| Selector | Propiedades |
| --- | --- |
| `@page` | `margin`, `margin-top`, `margin-right`, `margin-bottom`, `margin-left` (`pt`, `mm`, `cm`, `in`, `px`) |
| `body`, `html`, `:root` | `font-family`, `font-size`, `line-height`, `color`, `background-color`, `margin-bottom`, `--block-spacing`, `--muted-color` |
| `p` | `line-height`, `color`, `margin-bottom`, `--block-spacing` |
| `h1` a `h4` | `font-size`, `color` |
| `pre`, `code` | `font-family`, `color`, `background-color` |
| `blockquote` | `color`, `border-color` (la barra de la cita) |
| `a` | `color` |
| `table` | `color`, `background-color` |
| `th` | `color`, `background-color` |
| `hr` | `color` |

## Limitaciones

- **Solo UTF-8.** Los ficheros se leen como UTF-8 y se escriben de vuelta byte
Expand Down
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,41 @@ Markers replaced by an ornament (bullets, `[x]`, `---`, `>`, fences, pipes) are
shrunk rather than hidden: the tiny glyph stays in GTK's layout, so the
invisible-text abort path of GNOME/gtk#8346 is unreachable by construction.

## Stylesheets
## Themes and stylesheets

`Preferences > Export > Stylesheet` loads a CSS file that is applied on top of
the page template. It is a mapped subset, not a CSS engine: the export paints
and paginates with cairo, so each declaration is translated into a value the
layout already understands, and anything outside this table is ignored (the
export warns once and keeps going).
Export styles come in two layers that stack: a page template decides the
geometry (margins, leading, heading sizes, running header and footer, title
block), and a theme decides typography and colour. `Preferences > Export > Theme`
offers four bundled themes, written with our own values and compiled into the
binary so there is nothing extra to install:

| Theme | What it does |
| --- | --- |
| None | Leave the template as it is |
| Sepia | Cream paper, warm serif, wide leading and large headings for long reading |
| High contrast | Bigger sans text, black on white, blue links, for printing |
| Technical | Everything monospaced with tight spacing and navy headings, for notes and code |
| Academic | Eleven point serif with double leading and small headings, like a journal page |

Any theme combines with any template. The `Stylesheet` row of the same group
takes a CSS file from disk, applied on top of the theme, so it can correct a
single detail of it. The parser is a mapped subset, not a CSS engine: the
export paints and paginates with cairo, so each declaration is translated into a
value the layout already understands, and anything outside this table is ignored
(the export warns once and keeps going).

| Selector | Properties |
| --- | --- |
| `@page` | `margin`, `margin-top`, `margin-right`, `margin-bottom`, `margin-left` (`pt`, `mm`, `cm`, `in`, `px`) |
| `body`, `html`, `:root` | `font-family`, `font-size`, `line-height`, `color`, `background-color`, `margin-bottom`, `--block-spacing` |
| `body`, `html`, `:root` | `font-family`, `font-size`, `line-height`, `color`, `background-color`, `margin-bottom`, `--block-spacing`, `--muted-color` |
| `p` | `line-height`, `color`, `margin-bottom`, `--block-spacing` |
| `h1` to `h4` | `font-size`, `color` |
| `pre`, `code` | `font-family`, `color`, `background-color` |
| `blockquote`, `a`, `table` | `color`, plus `background-color` on `table` |
| `blockquote` | `color`, `border-color` (the quote bar) |
| `a` | `color` |
| `table` | `color`, `background-color` |
| `th` | `color`, `background-color` |
| `hr` | `color` |

When the sheet says nothing about a value, the template keeps its own, and
removing the file restores the previous output exactly. Example:
Expand Down
11 changes: 11 additions & 0 deletions data/io.github.gnacho.Scribe.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
<value nick="letter" value="3"/>
<value nick="compact" value="4"/>
</enum>
<enum id="io.github.gnacho.Scribe.ExportTheme">
<value nick="none" value="0"/>
<value nick="sepia" value="1"/>
<value nick="high-contrast" value="2"/>
<value nick="technical" value="3"/>
<value nick="academic" value="4"/>
</enum>

<schema id="io.github.gnacho.Scribe" path="/io/github/gnacho/Scribe/">
<key name="window-width" type="i">
Expand Down Expand Up @@ -163,6 +170,10 @@
<default>'custom'</default>
<summary>PDF export page template</summary>
</key>
<key name="export-theme" enum="io.github.gnacho.Scribe.ExportTheme">
<default>'none'</default>
<summary>PDF export stylesheet theme applied on top of the page template</summary>
</key>
<key name="export-css-path" type="s">
<default>''</default>
<summary>Path of the user stylesheet applied on top of the page template</summary>
Expand Down
41 changes: 41 additions & 0 deletions data/themes/academic.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Tema Académico: serif sobria, cabeceras pequeñas e interlineado doble, como un paper. */

body {
font-family: "Source Serif 4", Georgia, serif;
font-size: 11pt;
line-height: 2;
color: #111111;
background-color: #ffffff;
--muted-color: #555555;
--block-spacing: 10pt;
}

h1,
h2,
h3,
h4 {
color: #111111;
}

h1 { font-size: 15pt; }
h2 { font-size: 13pt; }
h3 { font-size: 11.5pt; }
h4 { font-size: 11pt; }

pre,
code {
color: #222222;
background-color: #f4f4f4;
}

blockquote {
color: #333333;
border-color: #999999;
}

a { color: #1a3d6d; }

table { background-color: #ffffff; }
table th { background-color: #f0f0f0; }

hr { color: #bbbbbb; }
41 changes: 41 additions & 0 deletions data/themes/high-contrast.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Tema Alto contraste: negro sobre blanco y texto grande, para imprimir y para vista cansada. */

body {
font-family: sans-serif;
font-size: 14pt;
line-height: 1.65;
color: #000000;
background-color: #ffffff;
--muted-color: #1f1f1f;
--block-spacing: 16pt;
}

h1,
h2,
h3,
h4 {
color: #000000;
}

h1 { font-size: 28pt; }
h2 { font-size: 21pt; }
h3 { font-size: 17pt; }
h4 { font-size: 14pt; }

pre,
code {
color: #000000;
background-color: #e8e8e8;
}

blockquote {
color: #000000;
border-color: #000000;
}

a { color: #0000ee; }

table { background-color: #ffffff; }
table th { background-color: #e0e0e0; }

hr { color: #000000; }
41 changes: 41 additions & 0 deletions data/themes/sepia.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Tema Sepia: papel crema, serif cálida y mucho aire, para leer largo rato. */

body {
font-family: "Source Serif 4", Georgia, serif;
font-size: 12pt;
line-height: 1.75;
color: #43362a;
background-color: #f6efe0;
--muted-color: #85705a;
--block-spacing: 13pt;
}

h1,
h2,
h3,
h4 {
color: #6b4f31;
}

h1 { font-size: 25pt; }
h2 { font-size: 18.5pt; }
h3 { font-size: 14.5pt; }
h4 { font-size: 12.5pt; }

pre,
code {
color: #4a3b2c;
background-color: #ece1cb;
}

blockquote {
color: #6b5a45;
border-color: #c2ab84;
}

a { color: #8a5a2b; }

table { background-color: #f1e8d6; }
table th { background-color: #e4d7bc; }

hr { color: #d3c19f; }
41 changes: 41 additions & 0 deletions data/themes/technical.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Tema Técnico: todo monoespaciado y apretado, para notas, logs y documentación de código. */

body {
font-family: "Adwaita Mono", monospace;
font-size: 9.5pt;
line-height: 1.5;
color: #1d1f21;
background-color: #ffffff;
--muted-color: #5f6773;
--block-spacing: 6pt;
}

h1,
h2,
h3,
h4 {
color: #0b3d91;
}

h1 { font-size: 15pt; }
h2 { font-size: 12.5pt; }
h3 { font-size: 11pt; }
h4 { font-size: 10pt; }

pre,
code {
color: #1f2937;
background-color: #eef1f5;
}

blockquote {
color: #47505c;
border-color: #b8c0cc;
}

a { color: #0b63c5; }

table { background-color: #f7f9fb; }
table th { background-color: #e6ebf1; }

hr { color: #b8c0cc; }
Loading