Feature request #7611
Title case option which also operates on uppercase words
|Pull Request or Patch supplied:||No||Resolution:|
|Easy fix?:||No||Copied to github as #:||16539|
Setting a type case of "Title case" has no effect on the way labels are rendered when the text is already in upper case. For example, in the attached image "KNOX" is rendered as "KNOX", not "Knox". The other case settings (All uppercase/lowercase) work as expected.
As discussed, "Title case" has been renamed "capitalize first letter", so this is now a feature request for a "Title case" feature, which would also lowercase subsequent letters.
#1 Updated by Borys Jurgiel almost 8 years ago
- Resolution set to invalid
I wouldn't expect the title() function will convert upper case characters to lower case. It would be a regression, as you couldn't create labels like "Quantum GIS Headquarters". In your case you can simply use: title(lower(lga_name))
I'm closing the ticket, but of course feel free to reopen if you disagree or I misunderstood something.
#3 Updated by Larry Shaffer almost 8 years ago
- Status changed from Closed to Reopened
- Resolution deleted (
The Title case used there in labeling is Qt's 'Capitalize' from QFont enum Capitalization:
QFont::Capitalize 4 This alters the text to be rendered with the first character of each word as an uppercase character.
However, this differs from how page-layout programs and the 'title' function in the Expression editor work. Usually, setting title case will convert uppercase letters to lowercase, as is done in the title function.
I propose to rename the Title function Nyall refers to as 'Capitalize' or 'Capitalize first letter' instead, so there is no confusion.
#4 Updated by Nyall Dawson almost 8 years ago
Borys - that makes sense, but as Larry pointed out it's a bit confusing for users. My vote would be to change the wording to "Capitalize first letter", since that makes it a bit clearer that it only applies to the first letter and not the rest of the letters.
#5 Updated by Nyall Dawson almost 8 years ago
Borys - after thinking about this, I'm a little puzzled what the use case is for your example. Are you saying you have a value in your table with mixed but predominantly lower-case characters ("quantum GIS headquarters")? Wouldn't it be much more common to have either all lower-case or all upper-case values in a table? Or is this function designed more for converting sentences like "Located at quantum GIS headquarters."?
#6 Updated by Borys Jurgiel almost 8 years ago
Maybe my example was too abstract, better one would be POI names that are sometimes acronyms. I prefer to be forced to use the two functions capitalize(lower(lga_name)) over having no way to preserve acronyms. Of course the best would be to have both capitalize() and title().
But maybe it's not so important. Usually I have the luck to work on properly prepared data, so I don't have much experience with correcting poor data at this stage. I don't insist anymore :)
#7 Updated by Nyall Dawson almost 8 years ago
Lucky -- Almost all the data I work with is poorly formatted! Anyway, I think the best resolution would be renaming Title case -> Capitalize First Letter for now, and then ideally adding a proper "Title case" option after 2.0. We could even make it handle fancy things like not capitalizing "a" or "the" when they're in the middle of a string...