Q:

Creating a handler to increase font size

I am working on a text app, which includes a button to increase text size of selected text in a field.
Below is the handler I am using, it works fine when all the selectedText is currently the same size. If some of the text is a different size, the handler returns this error: 

execution error at line 42 (Operators +: error in left operand), char
  68

The handler:
on txtSizeUp
     set the textSize of selectedText to the textSize of selectedText + 2
end txtSizeUp

WHat do I need to do to change the size regardless of difference?

A:

Change your handler to use the selectedChunk instead of the selectedText.
on txtSizeUp
   set the textSize of the selectedChunk to the textSize of the selectedChunk + 1
end txtSizeUp

And for good measure, of course:
on txtSizeDown
   set the textSize of the selectedChunk to the textSize of the selectedChunk - 1
end txtSizeDown

Edit: The handlers above only work if the textSize of the entire selectedChunk is the same. You want to be able to increment the text size even if there are different sizes within the selection. (I had missed that detail in your original question.)
The problem is that the selectedChunk function returns the string "mixed" when there are varying sizes within the selection. That is why you were getting an error; the set statement was trying to add mixed + 1, a data type mismatch. Here is a handler that should do what you want.
on txtSizeUp
  put the effective textSize of the selectedChunk into tSize
  if tSize is a number then
    set the textSize of the selectedChunk to \
       the effective textSize of the selectedChunk + 1
  else
    lock screen
    put the long name of the selectedField into tFld
    put word 2 of the selectedChunk into tStartChar
    put word 4 of the selectedChunk into tEndChar
    repeat with x = tStartChar to tEndChar
        set the textSize of char x of tFld to \
           the effective textSize of char x of tFld +1
    end repeat
    unlock screen
  end if
end txtSizeUp

There will be other approaches that will work, but they will all involve looping through the selected text in some way.

