Word painting is often used whenever composers would like to create music that will go well with the lyrics of the song. For example, there may be descending scales that will be used by the composers in order to depict doom or something sad while ascending scales will mean joy and happiness that should coincide properly with the meaning of the song.
Knowing the literal meaning of the song or the phrase will be very essential to use this technique properly. Some composers would need to do some practice before they can make this appropriately. There are still other techniques that composers may use in order to create songs.