Scribus Forums

Scribus => Beginner Talk => Topic started by: itskando on August 04, 2018, 08:31:12 PM

Title: Create text on a metric grid
Post by: itskando on August 04, 2018, 08:31:12 PM
I created graph paper with 5 [mm] x 5 [mm] indices. 
I drew on the graph paper (see attachment), and

I want to recreate the drawing digitally in scribus (to scale).
I believe it will be a fun and interesting learning experience.

Grid: Set usable space

I don't plan to render the grid on the printed paper,
but I wanted to work with a fine 1 [mm] x 1 [mm] grid.
I setup a letter canvas; thus the canvas measures:
215.9 [mm] x 279.4 [mm].

To my knowledge,
it is not possible to align the standard grid to the margins or the page center.
Instead, I attempted to create guides and align them to the margins.

I first set the usable space of the canvas to easily divisible integer values:
200 [mm] x 260 [mm].

I thus set the margins to:
215.9 [mm] - 200 [mm] = 15.9 [mm.leftANDright] = 15.9/2 [mm.leftORright]
279.4 [mm] - 260 [mm] = 19.4 [mm.topANDbottom] = 19.4/2 [mm.topORbottom]

Thus, the margins are:
7.95 [mm] (left)
7.95 [mm] (right)
9.70 [mm] (top)
9.70 [mm] (bottom)

Grid: Set guidelines

Now that the usable canvas is 200 [mm] x 260 [mm],
I can create column/row guides aligned to the margins.

I want a fine 1 [mm] x 1 [mm] grid, thus
I should make 200 vertical guide lines and 260 horizontal guide lines;
however, the maximum number of column/row guidelines I can create is 99.

Is there any method to increase this maximum?

As far as I know, there is not, so I shift to a 5 [mm] x 5 [mm] grid.
260 [mm] / 5 [mm/guideline] = 52 [guidelines] (horizontal)
200 [mm] / 5 [mm/guideline] = 40 [guidelines] (vertical)

I set this up; however, the grid does not align correctly.
For example, if I place a text frame with a position origin at the the top-left corner
at Y-position = (margin) + (3 guidelines), thus:

Y-position = 9.7 [mm] + 3 • 5 [mm] = 24.7 [mm]

the top line of the text frame border should align with the third guide line.
It is slightly off.

I realized that the final line might not render because it aligns with the margin exactly; thus
I removed one guideline from each direction.

52 [guidelines] - 1 [guidelines] = 51 [guidelines] (horizontal)
40 [guidelines] - 1 [guidelines] = 39 [guidelines] (vertical)

With this modification, I was able to make an actual 5 [mm] x 5 [mm] grid.

If anyone knows a better method to craft a fine grid, please let me know.
I have included some of the workarounds I attempted below; however,
I was unable to find success with the first or complete the second.

Grid: Guidelines use gap workaround [Fail]

I had hoped to double the precision of the grid by enabling the Use Gap function in each direction.
In theory, if I set the gap to half of the distance between guidelines (2.5 [mm] in each direction),
I would double the number of guidelines; however, if enabled,
the top line of my above-mentioned example text-frame-border again disaligns from the third guide line.
I was unable to determine why enabling the use gap feature disaligns the grid.

Grid: Generate custom grid [Fail]

I figured that I could generate a grid and then object snap to it, and
I found a script on the Scribus wiki which could do so (source (https://wiki.scribus.net/canvas/Drawing_a_grid)); however,
running the script caused Scribus to unexpectedly crash.

Python with Tkinter has been installed, as specified.
I checked the scripting troubleshooting guide (source (https://wiki.scribus.net/canvas/Troubleshooting_Scripts)); however,
I'm having trouble discerning what might be outdated or if outdated code is even the problem.

Glyph: specific vertical sizing:

I would ultimately prefer that I could specify within a text frame:
• the height of a text frame,
• the visible height of a glyph
• the invisible top height of a glyph, and
• the invisible bottom height of a glyph


For example:
• Text frame height: 15 [mm]
• Visible height of the glyph 'T': 13 [mm]
• Invisible whitespace height above the glyph 'T': 01 [mm]
• Invisible whitespace height below the glyph 'T': 01 [mm]

I could then set a border around the text frame with rounded edges,
(which is an ulterior desire).

Is the glyph size actually relative to
the maximum and minimum position of all glyphs included with the font?


Glyph: specific vertical sizing: Grid alignment

Instead of specifying the glyph size exactly,
I am creating the aforementioned grid and visually tuning the size of the glyphs; however

This process of eyeballing is particularly inefficient due to the lack of grid precision
when characters are offset by increments smaller than the precision of the 5 [mm] grid,
(such as 1 - 4 [mm] above or below a given grid line).

Even so, my process is as follows:

I can create text frames which align to the guidelines.

I can then create glyphs within that text frame which are set to maximum ascent, such that
the topmost visible glyph pixel is aligned with the top border of the text frame (ignoring whitespace).

Is there any method to additionally align
the bottommost visible glyph pixel with the bottom border of the text frame (ignoring whitespace)
, whether by setting
the vertical distance of the visible pixels of text equal to the vertical distance of the text frame, and/or, by setting
the vertical distance of the text frame to the vertical distance of the visible pixels?

Indirectly, this also asks the question,
is it possible to reduce the size of the bottom border of the textframe
into the lower invisible/whitespace portion of the text
without causing the text to disappear?


Since I currently believe that the above mentioned concepts are not possible,
I tune the text pixel size until a standard capitol letter aligns to the grid vertically;
(for example, I can alter the size of a capitol T until it is exactly 3 guide lines tall).

If I use a monospace font, I can then
tune the scaling width until the first character aligns to the grid horizontally;
(for example, I can alter the size of the capitol S in the example above until it is exactly 1 guide line wide).

Once this scaling is achieved, it becomes possible to type along the grid; however,
it is still difficult to wrap a border around the text frame which is a specific distance from the top and bottom of the text,
due to the required whitespace of the bottom of the textbox.

At this point, would it be better to create the text in Illustrator,
convert it to .pdf, and then import it into Scribus?

This seems conterproductive to the whole point of using Scribus, however.

[attachment deleted by admin]
Title: Re: Create text on a metric grid
Post by: dragonfly on August 04, 2018, 09:41:01 PM
That is a difficult workflow to create in Scribus.

If you want to create this only using Scribus then I would look at applying css styles to your glyphs.

...

However, this is the approach I would try.
Creating your object in SVG using Inkscape and then importing SVG into Scribus.

...

Install Inkscape.

Read here about creating grid.

https://graphicdesign.stackexchange.com/questions/21611/drawing-grid-in-inkscape-in-millimeter

Open new file in Inkscape.

Menu > View > Page Grid .. tick to enable

File > Document Properties > Grids .. set grid properties

Overlay objects on grid by selecting rectangle objects and launch Fill and Stroke panel to set rectangle properties.

Text and glyphs will be created in text objects.

When the layout is complete save as SVG and then import SVG into Scribus.
Title: Re: Create text on a metric grid
Post by: dragonfly on August 05, 2018, 12:48:41 PM
Further notes from my playing around with Scribus.

QuoteGlyph: specific vertical sizing:

I would ultimately prefer that I could specify within a text frame:
• the height of a text frame,
• the visible height of a glyph
• the invisible top height of a glyph, and
• the invisible bottom height of a glyph

You can easily wrap space around glyphs by using nested textframes.

i.e. have an outer textframe and inside you have a "glyphframe" (a normal textframe).

The outer textframe can have rounded corners.
You can then bind (group) the outer and inner textframes.

I have created in Scribus the effect you want.