If I am not mistaken, his lineage traced to King David on his Mother AND his father’s side.
If you refer to Joseph as the father of Jesus, yes he was in the line of David, but you would not be speaking of His actual father, which we all know is God, through the Spirit.