Se cambio la font di un testo ruotato, alcune font me le accetta (es. Arial Narrow, Courier New), altre non le riconosce (es. Windings, OCR-B-10 BT) e le sostituisce con quello di default (Arial). Se le stesse font le uso semplicemente con l'oggetto printer senza ruotare il testo, allora me le riconosce. Da che può dipendere? Allego il codice.
Grazie
codice:Private Const LF_FACESIZE = 32 Private Type LOGFONT lfHeight As Long lfWidth As Long lfEscapement As Long lfOrientation As Long lfWeight As Long lfItalic As Byte lfUnderline As Byte lfStrikeOut As Byte lfCharSet As Byte lfOutPrecision As Byte lfClipPrecision As Byte lfQuality As Byte lfPitchAndFamily As Byte lfFaceName As String * LF_FACESIZE End Type Private Type DOCINFO cbSize As Long lpszDocName As String lpszOutput As String lpszDatatype As String fwType As Long End Type Private Declare Function CreateFontIndirect Lib "gdi32" Alias _ "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long Private Declare Function SelectObject Lib "gdi32" _ (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function DeleteObject Lib "gdi32" _ (ByVal hObject As Long) As Long Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _ (ByVal lpDriverName As String, ByVal lpDeviceName As String, _ ByVal lpOutput As Long, ByVal lpInitData As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) _ As Long Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" _ (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, _ ByVal lpString As String, ByVal nCount As Long) As Long ' or Boolean Private Declare Function StartDoc Lib "gdi32" Alias "StartDocA" _ (ByVal hdc As Long, lpdi As DOCINFO) As Long Private Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) _ As Long Private Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) _ As Long Private Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) _ As Long Sub StampaTestoVerticale(Testo As String, X As Double, Y As Double, TipoFont As String, DESIREDFONTSIZE As Double) Dim OutString As String Dim lf As LOGFONT Dim result As Long Dim hOldfont As Long Dim hPrintDc As Long Dim hFont As Long Dim CostanteMM As Double 'Printer.Print "Printer Object" lf.lfFaceName = Space(Len(lf.lfFaceName)) lf.lfFaceName = TipoFont & Chr(0) hPrintDc = Printer.hdc OutString = Trim(Testo) 'CostanteMM = 56.6928579108186 CostanteMM = 56.6928579108186 / 48 * 40 lf.lfEscapement = 900 lf.lfHeight = (DESIREDFONTSIZE * -20) / Printer.TwipsPerPixelY hFont = CreateFontIndirect(lf) hOldfont = SelectObject(hPrintDc, hFont) result = TextOut(hPrintDc, X * CostanteMM, Y * CostanteMM, OutString, Len(OutString)) result = SelectObject(hPrintDc, hOldfont) result = DeleteObject(hFont) End Sub Sub Prova StampaTestoVerticale "q", 37, 243, "Courier New", 16 'funziona StampaTestoVerticale "q", 47, 243, "Wingdings", 16 'non funziona, sostituisce con Arial Printer.FontName = "Wingdings" 'funziona Printer.Print "q" End Sub

Rispondi quotando