Jump to content

Search the Community

Showing results for tags 'stringsize'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. Honored Melba23, I once again beseech you for your assistance, please! I'm trying to use your wondrous StringSize() sorta in reverse: Given a font, size, weight, etc, what's the max # of characters that will fit in a given pixel width? Of course I realize that except for mono-spaced fonts, the result will depend on a specific string itself. but I've tried to compromize by submitting a string consisting of a number of the widest character I can think of, the capital "M" (at least for ANSI Latin alphabets). Here's a simple app I wrote to try it.. #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Constants.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <String.au3> #include <StringConstants.au3> #include <GDIPlus.au3> #include <GDIPlusConstants.au3> #include <StructureConstants.au3> #include <FontConstants.au3> #include <WinAPI.au3> #include "StringSize.au3" Opt("MustDeclareVars", 0) Const $Cmy_DefaultPathFontName="Franklin Gothic Medium Cond", $Cmy_DefaultPathFontSize="9", $Cmy_DefaultPathFontWeight="400" Const $Cmy_DefaultPathFontAttrib="0" Const $Cmy_NicknameFontName="Lucida Console", $Cmy_NicknameFontSize="11", $Cmy_NicknameFontWeight="400" Const $Cmy_NicknameFontAttrib="2" Const $Cmy_SlotPathFontCode = 1, $Cmy_SlotNicknameFontCode = 2, $Cmy_MaxBtnPathTxtLen = 90, $Cmy_MaxBtnNickTxtLen = 38 Local $ResultAra[4], $MaxLenResults[4], $ErrFound Local $FontInfo[4][6] = [ [ "Pathnames in Nickname Slots", 9, 400, 0, "Franklin Gothic Medium Cond", 305], _ [ "Nicknames in Nickname Slots", 11, 400, 2, "Lucida Console", 305], _ [ "Pathname under Picture", 11, 400, 0, "Gentium Book Basic", 730], _ [ "Notify String", 11, 700, 0, "High Tower Text", 500] ] $ErrFound = False ; For $i = 0 To 3 $MaxPixelLenSoFar = 0 $MaxCharLenSoFar = 1 $TestStrSoFar = "M" $GotMaxChars = False While (Not $GotMaxChars) And (Not $ErrFound) $ResultAra = _StringSize($TestStrSoFar, $FontInfo[$i][1], $FontInfo[$i][2], $FontInfo[$i][3], $FontInfo[$i][4], $FontInfo[$i][5]) If @error = 0 Then $RequiredPixelWidth = $ResultAra[2] If $RequiredPixelWidth < $FontInfo[$i][5] Then ; If we've still got room... $TestStrSoFar &= "M" $MaxCharLenSoFar += 1 Else $ResultAra[$i] = $MaxCharLenSoFar $GotMaxChars = True EndIf Else MsgBox($MB_OK, "StringSizeMaxTest Error", "Error: _StringSize() @error Returned: " & @error) $ErrFound = True Exit EndIf WEnd Next ; For $i = 0 To 3 MsgBox($MB_OK, "StringSizeMaxTest Results", "Max # chars for " & $FontInfo[$i][0] & " == " & $ResultAra[$i] ) Next ; MsgBox($MB_OK, "StringSizeMaxTest Results", "Press OK when ready") Exit What happens is the app always reports error 3: "GetDeviceCaps failure", from StringSize(). What's that all about? Thanks!
  2. When I set ExtMsgBox to use fixed font, the width is calculated incorrectly, so text wraps. my code: #include <_ExtMsgBox.au3> #include <Array.au3> _ExtMsgBoxSet(0, 0, -1, -1, 10, "courier new") ; Set _ExtMsgBox formatting ShowAbout() Func ShowAbout() Local $ar[1] = [0] _ArrayAdd($ar, "Program to bla bla bla.") _ArrayAdd($ar, "") _ArrayAdd($ar, "usage: " & "[-switch>] [<datafile>.csv]") _ArrayAdd($ar, "") _ArrayAdd($ar, "<-switch>:") _ArrayAdd($ar, "-h ....... Display this help information") _ArrayAdd($ar, "-nb ...... Do not create backup files.") _ArrayAdd($ar, "-regdel... Delete program relative registry items before") _ArrayAdd($ar, " running (debug mode only)") _ArrayAdd($ar, "-ro ...... Do not modify the input file.") _ArrayAdd($ar, "-tail .... Launch 'Tail' to tail the debug output file") _ArrayAdd($ar, "") _ArrayAdd($ar, "Copyright 2011-2016, Andy Scharmer") _ExtMsgBox(8, "OK", "About", _ArrayToString($ar, @CRLF, 1)) Return EndFunc ;==>ShowAbout
×
×
  • Create New...