The writer speaks of gladness as if it were an oil that God used to anoint the king. That God has anointed him is a symbolic action that represents God's choosing him to be king. Alternate translation: "when God appointed you as king, he made you very glad" (See: [[rc://en/ta/man/translate/figs-metaphor]] and [[rc://en/ta/man/translate/translate-symaction]])