Feature request #7611

Title case option which also operates on uppercase words

Added by Nyall Dawson almost 4 years ago. Updated almost 2 years ago.

Status:Reopened Start Date:04/14/2013
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Labelling
Target version:Future Release - Lower Priority
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

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.

EDIT
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.

title_case.png (259.9 kB) Nyall Dawson, 04/14/2013 05:15 am


Related issues

related to QGIS Application - Bug report #7724: Label type cases do not alter output if label text is upp... Closed 04/27/2013
related to QGIS Application - Feature request #8938: More text formatting options Closed 10/23/2013
duplicated by QGIS Application - Bug report #12804: The Label Option: FirstCap return always " all uppercase" Closed 05/21/2015

History

Updated by Borys Jurgiel almost 4 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.

Updated by Borys Jurgiel almost 4 years ago

  • Status changed from Open to Closed

Updated by Larry Shaffer almost 4 years ago

  • Status changed from Closed to Reopened
  • Resolution deleted (invalid)

Hi Nyall,

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.

Updated by Nyall Dawson almost 4 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.

Updated by Nyall Dawson almost 4 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."?

Updated by Borys Jurgiel almost 4 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 :)

Updated by Nyall Dawson almost 4 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...

Updated by J├╝rgen Fischer over 2 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

Updated by Alister Hood almost 2 years ago

  • Tracker changed from Bug report to Feature request
  • Subject changed from Title case has no effect to Title case option which also operates on uppercase words

Also available in: Atom