Draft: Forma da testo

From FreeCAD Documentation
Revision as of 21:45, 17 February 2023 by Marco T (talk | contribs) (Created page with "==Selezione file font su Windows==")

Forma da testo

Posizione nel menu
Drafting → Forma da testo
Ambiente
Draft, Arch
Avvio veloce
Nessuno
Introdotto nella versione
0.14
Vedere anche
Testo, Etichetta Estrusione

Descrizione

Il comando Forma da testo crea una forma composta che rappresenta una stringa di testo. Questa forma può essere utilizzata per creare lettere 3D con il comando Part Estrusione.

Il comando Forma da testo non è destinato alle annotazioni di testo standard. Il comando Testo o il comando Etichetta dovrebbe essere utilizzato a tale scopo.

Per posizionare una Forma da testo basta un singolo punto

Utilizzo

Per gli utenti Windows: leggere prima il paragrafo Selezione file font su Windows.

  1. Esistono diversi modi per invocare il comando:
    • Premere il pulsante Forma da testo.
    • Selezionare l'opzione Drafting → Forma da testo dal menu.
  2. Si apre il pannello attività Forma da testo.
  3. Fare clic su un punto nella Vista 3D o digitare le coordinate.
  4. Facoltativamente, premere il pulsante Reimposta punto per reimpostare il punto all'origine.
  5. Inserire una Stringa.
  6. Specificare l'Altezza.
  7. Per selezionare un carattere, eseguire una delle seguenti operazioni:
    • Inserire un percorso file nella casella di input Font file.
    • Premere il pulsante ... e selezionare un file.
  8. Premere il pulsante OK per terminare il comando.

Opzioni

  • Premer Esc o il pulsante Annulla per interrompere il comando.

Note

  • Una Forma da testo può essere modificata facendo doppio clic su di essa nella Vista ad albero. disponibile dalla versione 0.20
  • I font supportati includono TrueType (.ttf), OpenType (.otf) e Type 1 (.pfb).
  • Il comando è limitato al testo LTR (da sinistra a destra). Pertanto al momento il testo RTL (da destra a sinistra + dall'alto verso il basso) non è supportato.
  • Altezze del testo molto piccole possono causare forme dei caratteri deformate a causa della perdita di dettagli nel ridimensionamento.
  • Molti font genereranno geometrie problematiche. Questo perché i contorni dei caratteri possono sovrapporsi, avere piccoli spazi e avere direzioni diverse all'interno di un glifo. Queste condizioni sono considerate errori nelle poliline utilizzate per definire le facce.
  • Forma da testo può anche essere creato con Macro Fonts Win10 PYMP.
  • Per creare Forme da testo disposte in modo circolare utilizzare il Macro FCCircularText.

Selezione file font su Windows

On Windows access to the default font folder is restricted. This affects the font file selection for ShapeStrings. There are three cases in FreeCAD where a font file for ShapeStrings can be specified: in the ShapeString task panel, when changing the DatiFont File property of a ShapeString, and when specifying the default font file in the Draft Preferences.

Pressing the ... button and then selecting a file from the default Windows font folder is not possible when using the native file dialog. There are a number of workarounds:

  • Make sure DontUseNativeFontDialog is set to true, which is the default value for this preference. This will only call a different, non-native, file dialog when pressing the ... button in the ShapeString task panel. With this file dialog the default Windows font folder can be accessed.
  • Change DontUseNativeDialog to true. This instructs FreeCAD to always use the non-native file dialog.
  • Specify the font file in the input box. You can of course type the full path or copy-paste the path from the Windows File Explorer. But there is also another way to enter the path. If you enter C:\ a dropdown list will appear. Select Windows from that list and add \F. Select Fonts from the new dropdown list. Finally add \ and the first letter(s) of the font file, and then select it from the dropdown list.
  • Create a custom folder for your font files.

See the Preferences paragraph below for the location of the mentioned preferences.

Tutorial

Preferences

See also: Preferences Editor, Draft Preferences and Std DlgParameter.

  • The default font file can be changed in the preferences: Edit → Preferences... → Draft → Texts and dimensions → Default ShapeString font file.
  • For Windows users:
    • Set Tools → Edit parameters... → BaseApp → Preferences → Dialog → DontUseNativeFontDialog to true to use the non-native file dialog when selecting a font file from the ShapeString task panel.
    • Alternatively, set Tools → Edit parameters... → BaseApp → Preferences → Dialog → DontUseNativeDialog to true to always use the non-native file dialog.

Proprietà

See also: Property editor.

A Draft ShapeString object is derived from a Part Part2DObject and inherits all its properties. It also has the following additional properties:

Data

Draft

  • DatiPosition: specifica la posizione del punto base della forma composta.
  • DatiAngle: specifica la rotazione della linea di base della forma.
  • DatiAxis: specifica l'asse da utilizzare per la rotazione.
  • DatiString: specifica la stringa di testo da visualizzare; a differenza dello strumento Testo, Forma da testo può visualizzare solo una singola riga.
  • DatiSize: specifica l'altezza generale delle lettere.
  • DatiTracking: specifica la spaziatura inter-carattere aggiuntiva nella stringa.
  • DatiFont File: specifica il percorso completo del file di font utilizzato per disegnare la stringa.

View

Draft

  • VistaPattern (Enumeration): specifies the Draft Pattern with which to fill the faces of the text. This property only works if VistaDisplay Mode is Flat Lines.
  • VistaPattern Size (Float): specifies the size of the Draft Pattern.

Scripting

Lo strumento ShapeString può essere utilizzato nelle macro e dalla console Python tramite la seguente funzione:

shapestring = make_shapestring(String, FontFile, Size=100, Tracking=0)
  • Crea una forma composta ShapeString usando la String specificata e il percorso completo di un FontFile supportato.
  • Size è l'altezza in millimetri del testo risultante.
  • Tracking è la spaziatura aggiuntiva tra i caratteri, in millimetri.

Il posizionamento di ShapeString può essere cambiato sovrascrivendo il suo attributo Placement, o sovrascrivendo singolarmente i suoi attributi Placement.Base e Placement.Rotation.

Esempio:

import FreeCAD as App
import Draft

doc = App.newDocument()

font1 = "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf"
font2 = "/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf"
font3 = "/usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf"

S1 = Draft.make_shapestring("This is a sample text", font1, 200)

S2 = Draft.make_shapestring("Inclined text", font2, 200, 10)

zaxis = App.Vector(0, 0, 1)
p2 = App.Vector(-1000, 500, 0)
place2 = App.Placement(p2, App.Rotation(zaxis, 45))
S2.Placement = place2

S3 = Draft.make_shapestring("Upside-down text", font3, 200, 10)
S3.Placement.Base = App.Vector(0, -1000, 0)
S3.Placement.Rotation = App.Rotation(zaxis, 180)

doc.recompute()