GithubHelp home page GithubHelp logo

ckrctxt's Introduction

ckrctxt :: RC Text Bounds Checker

ckrctxt is a simple tool that can check if any static text block (single or multi line) from a Visual Studio resource file (RC) doesn't fit on given rectangle size. On application UI the text appears truncated or clipped.

I assume most software developers write Win32 applications to be High DPI aware. Otherwise, it would be immediately visible if an application is not ready for High DPI because everything appears blury and text is pixelated.

From all High DPI issues, this tool is a solution for the most subtle one: Clipped UI elements or text.

A dialog created with Visual Studio resource editor usually looks fine on standard DPI. However, after changing the Windows display DPI to other standard configuration (125%, 150%, 200% and up to 500% on Windows 10) you might notice that the full text doesn't fit anymore.

ckrctxt tool was created to automatically detect such problems at build for Advanced Installer.

Build automation

An integration into any build system will basically execute:

ckrctxt --file [path-to-project].rc

Performance: it can scan a RC file with 40k lines, from which 4.5k text blocks to analyse in just ~300ms.

Command line options

Usage: ckrctxt [options]

Options:
-q, --quiet           no output, just return the counter
--no-header           do not show header for current DPI
-f, --file NAME       Resource Script file name or path

Examples

Single line text found at 150% display DPI:

display dpi: 144|144 (150%)

Dialog ID: IDD_EDIT_BUILD
-------------------------------
15225: LTEXT "Version:"
- detected text size: (59,19)px
- detected rect size: (25,8)du -> (56,19)px
+ minimum required rectangle size: (26,8)du

15227: LTEXT "Build:"
- detected text size: (41,19)px
- detected rect size: (16,8)du -> (36,19)px
+ minimum required rectangle size: (18,8)du

Dialog ID: IDD_FORM_CREATE_FILE
-------------------------------
17156: CONTROL "Create file with encoding:"
- detected text size: (181,19)px
- detected rect size: (90,10)du -> (178,24)px
+ minimum required rectangle size: (93,10)du

Quick indication: the CONTROL element on line 17156 from IDD_FORM_CREATE_FILE dialog should have 93du width.

Multi line text found at 150% display DPI:

display dpi: 144|144 (150%)

Dialog ID: IDD_WIZARD_INSTALL
-------------------------------
17246: CONTROL "The XYZ will not be installed by default.
                The user can choose to install it from ...
                or by selecting ..."
- detected text size: (377,52)px
- detected rect size: (267,29)du -> (383,47)px
+ minimum required rectangle size: (263,32)du  [MULTILINE]

Quick indication: the CONTROL element on line 17246 from IDD_WIZARD_INSTALL dialog should be extended to four lines (32du).

Full description:

  • the multi line text from this checkbox fits in a rectangle of (377,52) pixels
  • the rectangle of this CONTROL element is (267,29) dialog units, converted to pixels this is (383,47)
  • the required text height is 52px, but the rectangle height is 47px
  • the solution is to modify the rectangle height to 52px, aproximated to 32du

Implementation limits

At this time, the internal parser searches only for these text elements:

  • [LCR]TEXT
  • [DEF]PUSHBUTTON
  • CONTROL (check, 3state, radio)
  • RADIOBUTTON

ckrctxt's People

Contributors

d0ru avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.