Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Text vertikal ausdrucken (https://www.delphipraxis.net/2233-text-vertikal-ausdrucken.html)

Philippe Sch. 14. Jan 2003 06:43


Text vertikal ausdrucken
 
Hi, ich sollte auf einer Etikette, wo ich sonst den Text mit Printer.Canvas.Textout ausdrucke und positioniere, auch einige Ziffern präzise plaziert VERTIKAL ausdrucken. Hat mir jemand einen Tip, wie ich das machen könnte? Ist die MethodeFont-abhängig ('Sans Serif' für den übrigen Text).
Vielen Dank
Philippe

sakura 14. Jan 2003 08:32

Ein bisschen rumexperimentieren bleibt noch, aber folgender Code ist zur Manipulation der Schrift des Canvas. Beide, Escapement und Orientation sind für die Dreheung des Textes bzw. der Buchstaben von 0 bis 3600 einstellbar. (1 Grad entpricht 10 Einheiten. 90 Grad entsp. 900 Einheiten)
Delphi-Quellcode:
    Canvas := FLayer.Bitmap.Canvas;
    SetGraphicsMode(Canvas.Handle, GM_ADVANCED);
    SetTextCharacterExtra(Canvas.Handle, CharSpacing);
    Canvas.Font.Name := FontName;
    Canvas.Font.Color := Color;
    Canvas.Font.Size := FontSize;
    GetObject(Canvas.Font.Handle, SizeOf(LogFont), @LogFont);
    LogFont.lfEscapement := Escapement;
    LogFont.lfOrientation := Orientation;
    LogFont.lfWeight := Bold;
    LogFont.lfItalic := Byte(Italic);
    LogFont.lfUnderline := Byte(UnderLine);
    LogFont.lfStrikeOut := Byte(StrikeOut);
    LogFont.lfCharSet := Charset;
    if AntiAlias then
      LogFont.lfQuality := ANTIALIASED_QUALITY
    else
      LogFont.lfQuality := NONANTIALIASED_QUALITY;
    OldFontHandle := Canvas.Font.Handle;
    Canvas.Font.Handle := CreateFontIndirect(LogFont);
    try
...
    finally
      DeleteObject(Canvas.Font.Handle);
      Canvas.Font.Handle := OldFontHandle;
    end;
    SetTextCharacterExtra(Canvas.Handle, 0);
    SetGraphicsMode(Canvas.Handle, GM_COMPATIBLE);

Philippe Sch. 14. Jan 2003 09:34

danke für den Tip. Werde es heute Abend ausprobieren.Noch eine Frage: geht das mit jedem Font,oder braucht es dazu spezielle?

sakura 14. Jan 2003 09:38

Es sollte schon ein TrueType bzw. eine OpenType Font sein. Also eigentlich mit jeder. Wie es dann aussieht...
...:cat:...


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:39 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz