Jump to content

Search the Community

Showing results for tags 'melba23'.

  • 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 1 result

  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!
×
×
  • Create New...