Feature request #7611

Title case option which also operates on uppercase words

Added by Nyall Dawson almost 11 years ago. Updated almost 7 years ago.

Status:Reopened
Priority:Normal
Assignee:-
Category:Labelling
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:16539

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 (260 KB) Nyall Dawson, 2013-04-14 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 2013-04-27
Related to QGIS Application - Feature request #8938: More text formatting options Closed 2013-10-23
Duplicated by QGIS Application - Bug report #12804: The Label Option: FirstCap return always " all uppercase" Closed 2015-05-21

History

#1 Updated by Borys Jurgiel almost 11 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.

#2 Updated by Borys Jurgiel almost 11 years ago

  • Status changed from Open to Closed

#3 Updated by Larry Shaffer almost 11 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.

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

#8 Updated by Jürgen Fischer over 9 years ago

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

#9 Updated by Alister Hood almost 9 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

#10 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No

Also available in: Atom PDF